open terminal via ssh run firefox -> display not found
Solution 1
Make sure that the remote machine has ssh X11 forwarding enabled:
$ grep X11 /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
$
Use ssh -X user@remote_machine
to connect to remote machine.
If on remote machine you are using a different user to start the X client, use xauth list
to get the current credentials in the ssh user, then use xauth add
to add the credentials to the user you are becoming with sudo/su.
read -p 'Username: ' u;sudo -H -u $u xauth add $(xauth list|grep :$(echo ${DISPLAY: -4:2}));sudo su - $u
Solution 2
If the question is what I think it is
ssh testuser@ubuntuhost firefox --display :0 -no-remote
Will start firefox on ubuntuhost and have it display on that machine, assuming testuser is logged on to ubuntuhost already.
I don't know Selenium, or what exactly you're looking to test (performance, correctness of display, or simply a success return value from some javascript) but you might not even need a 'real' X server, i.e. one that actually appears on the monitor of the Ubuntu host. Xvfb might be helpful for you here, but that's beyond the scope of the original question...
Related videos on Youtube
nebenmir
Updated on September 18, 2022Comments
-
nebenmir over 1 year
I want to run selenium tests on a Hudson slave.
The slave (i.e. the machine) that will execute the selenium is a Ubuntu 10.04.
Thus it has Gnome. Selenium needs a firefox to run.What Hudson does now is, it creates a ssh connection to the Ubuntu machine and launches selenium there. Selenium tries to start a firefox.
And now it blames:
Error: cannot open display
What needs to be done that the 'ssh shell' gets a display from the X-server?
-
user3568302 almost 13 yearsI think many people are misunderstanding your question, or I am. To be clear, do you intend for Firefox to run on the Ubuntu machine and display on the Ubuntu machine? I.e. you are not asking how to have Firefox display back to the Hudson server, (which only triggers the test)
-
user3568302 almost 13 yearshave you seen this rather similar question: serverfault.com/questions/108781/… ?
-
-
user649102 almost 13 yearsIf one has a firefox running on the local machine the '-no-remote' command line switch should be used to really run a new instance. (firefox would discover the already running one and quit silently)
-
nebenmir almost 13 yearsI'm sorry but that does not work. Still get foo@hitchhiker:~$ ssh ci@kabul firefox -display :0 -no-remote ci@kabul's password: Error: no display specified
-
nebenmir almost 13 yearsThanx. The given command works. But the problem is, that I need to get Hudson to append the X paramter to the ssh command. But I guess this is not the right forum for hudson specific settings.
-
user3568302 almost 13 years@nebenmir: sorry, my mistake, firefox takes "--display", not "-display"