As root, I'm connecting to a remote host to execute a command. Only "standarduser" has the appropriate id-file and correct .ssh/config, so I'm switching the user first:
su standarduser -c 'ssh -x remotehost ./remotecommand'
The command works fine, but despite the fact that I used "-x" (disable X11-Forwarding) and having X11Forwards disabled in
/etc/ssh/ssh_config, I still get the error message:
X11 connection rejected because of wrong authentication.
I'm not getting the error message when I'm logged in as "standarduser".
This is quite annoying as I would like to integrate the command in a cron job file. I understand that the error message refers to the wrong authentication of root's .XAuth file, but I'm not even trying to connect via X11.
Why is "ssh -x" not disabling the X11 connection and throwing the error message?
UPDATE: The message only shows when I'm logged in within a screen, when using the command stated above on the local machine itself (without screen), I don't get an error message, so this should be fine with cron, too.
I also started the same command with
-v and surprisingly got the error message FIRST, even before the status information from SSH:
root@localhost:~# su standarduser -c 'ssh -x remotehost ./remotecommand' X11 connection rejected because of wrong authentication. OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013
This led me to the problem itself, it is NOT the
ssh which is throwing the error message, it's
root@localhost:~# su standarduser -c 'echo Hi' X11 connection rejected because of wrong authentication. Hi
Why do I only get this error within
screen? How can I disable this error message?