Code: Select all
ssh -Y <remote host>
Code: Select all
ssh -Y <remote host>
That sounds like the correct behaviour to me. When you ssh in as root, it probably does have DISPLAY set for your initial user because of your ssh X11 forwarding but then you su to root and that will lose it and then you su to the user in question and that won't preserve it either. X11 forwarding doesn't work if you change user by design. The only bit that confuses me is the undefined variable - I've been unable to recreate that at all, I only ever get a display or a blank line. Like this:I'm using ssh -X <hostname> to login to this remote system, doing sudo su - to get to root, doing su - <username> to get to the username that's having the issue.
I'm issuing the command "echo $DISPLAY", expecting to see something like ":0.0" but getting "DISPLAY: Undefined variable" instead
Code: Select all
[trevor@trevor4 SPECS]$ ssh -X centos7
Last login: Wed Mar 7 16:50:39 2018 from trevor4
[trevor@centos7 ~]$ echo $DISPLAY
localhost:10.0
[trevor@centos7 ~]$ sudo su -
[sudo] password for trevor:
Last login: Wed Mar 7 16:51:13 GMT 2018 on pts/0
[root@centos7 ~]# echo $DISPLAY
[root@centos7 ~]# su - trevor
Last login: Wed Mar 7 16:51:16 GMT 2018 from trevor4 on pts/0
[trevor@centos7 ~]$ echo $DISPLAY
[trevor@centos7 ~]$