X2Go “stdin: is not a tty” error on login

Apparently from time to time the contents of /root/.profile are for some reason changed within the Ubuntu 16.04 installation.

The default looks like this:

# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
 if [ -f ~/.bashrc ]; then
 . ~/.bashrc

mesg n

Which doesn’t work well together with X2Go interface. Basically you need to amend the last line “mesg n” with following:

tty -s && mesg n

Reboot the machine and profit 🙂