Page 1 of 1
Xterm Fails For Sudo User
Posted: 15. Jun 2015, 00:37
by sweeny_here
The Xterm command fails after sudo'ing to another user -
tomcat@xbt-dkt-14-01:~$ xterm
No protocol specified
xterm: Xt error: Can't open display: :0.0
Yet when the same command is executed as a different user the command executes without issue.
qwerty@xbt-dkt-14-01:/opt/tomcat$ xterm
Works
Running VirtualBox v4.3.26 on Windows 7.
The guest is Xubuntu 14.04.
Any help or suggestions would be much appreciated.
Both the host and guest are patched up to date.
Re: Xterm Fails For Sudo User
Posted: 15. Jun 2015, 10:56
by sweeny_here
I've also tried reinstalling the Linux Guest Additions for the Xubuntu guest, but to no avail.
Re: Xterm Fails For Sudo User
Posted: 15. Jun 2015, 11:43
by sweeny_here
The series to commands execute leading up to the error -
On the client
xhost +
Set "ForwardX11 yes" in /etc/ssh/ssh_config
Connect to the server
ssh user@remote-host
sudo su - tomcat
echo $DISPLAY
This is blank
Set DISPLAY to the client IP
export DISPLAY=192.168.1.50:0
tomcat@xbt-dkt-14-01:~$ xterm
No protocol specified
xterm: Xt error: Can't open display: :0.0
Re: Xterm Fails For Sudo User
Posted: 15. Jun 2015, 12:32
by noteirak
Looks like a network/software issue, not a VirtualBox issue. What makes you think this can be related to VirtualBox? Have you tried looking for X11 howto & support info first?
Re: Xterm Fails For Sudo User
Posted: 16. Jun 2015, 09:13
by sweeny_here
The reason for thinking it is a Virtual Box issue, when a similar request is made from an identical OS (Xubuntu 14.04) that is not running on Virtual Box, the request succeeds.
I've also disabled the UFW to ensure no firewall interruptions, but this makes no difference. There is no useful info being captured in the logs either.
Re: Xterm Fails For Sudo User
Posted: 16. Jun 2015, 12:58
by ikar.us
sweeny_here wrote:Set DISPLAY to the client IP
export DISPLAY=192.168.1.50:0
If tunneling, I' expect the display to be localhots:10 or something like that.
Can you display X apps without su?
What is $DISPLAY then?
Re: Xterm Fails For Sudo User
Posted: 16. Jun 2015, 15:48
by sweeny_here
Yes "xterm" will lauch for the ssh'ed user.
When su'ed via "sudo su - tomcat" and "xterm" is executed on the remote machine this error appears -
tomcat@xbt-dkt-14-01:~$ xterm
No protocol specified
xterm: Xt error: Can't open display: :0.0
If the ~/.Xauthority file is copied from the ssh'ed user directory on the remote host to the tomcat home directory and ownership adjusted accordingly, then the "xterm" command launches without error, but only for the current session.
At this point DISPLAY is set to "localhost:0"
If the ssh session is terminated, then above process needs to be repeated for subsequent logins.
So – it looks like the issue is around passing DISPLAY between su sessions.