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.
Xterm Fails For Sudo User
-
sweeny_here
- Posts: 6
- Joined: 15. Jun 2015, 00:12
Re: Xterm Fails For Sudo User
I've also tried reinstalling the Linux Guest Additions for the Xubuntu guest, but to no avail.
-
sweeny_here
- Posts: 6
- Joined: 15. Jun 2015, 00:12
Re: Xterm Fails For Sudo User
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
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
Last edited by sweeny_here on 16. Jun 2015, 12:16, edited 1 time in total.
-
noteirak
- Site Moderator
- Posts: 5231
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: Xterm Fails For Sudo User
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?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!
-
sweeny_here
- Posts: 6
- Joined: 15. Jun 2015, 00:12
Re: Xterm Fails For Sudo User
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.
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.
-
ikar.us
- Posts: 48
- Joined: 26. Aug 2010, 01:40
- Primary OS: MS Windows 8
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Debian u.a.
- Location: Baden
- Contact:
Re: Xterm Fails For Sudo User
If tunneling, I' expect the display to be localhots:10 or something like that.sweeny_here wrote:Set DISPLAY to the client IP
export DISPLAY=192.168.1.50:0
Can you display X apps without su?
What is $DISPLAY then?
-
sweeny_here
- Posts: 6
- Joined: 15. Jun 2015, 00:12
Re: Xterm Fails For Sudo User
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.
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.