i need to run firefox process on a remote host via ssh and also keep process running even after ssh logout. I already have tried these ways nohup firefox & ,screen,disown -h . but it seems these work only for the process without hardware display.because these work fine with my scripts and I can keep my scripts running even after ssh log out but I can't do the same for firefox. I am stuck with this for long. please help me out here !
Asked
Active
Viewed 857 times
1
-
Are you displaying the resulting Firefox window on the remote host's screen, or tunneling it over SSH to view locally? If the latter, you need to keep SSH open so the window can remain open. – Caesium Jan 28 '12 at 17:20
-
when i run firefox at remote host the window is displayed here on local machine.But I don't know tunneling.All I need to do is leave this instance of firefox running even after I log out from remote machine. – Pranay Agarwal Jan 28 '12 at 17:29
-
firefox does not behave as other applications do when you ssh -X. It will launch locally unless you use --no-remote. Tunnels are better, see my answer. – Panther Jan 28 '12 at 17:33
-
i didn't exactly understand your answer. After I ssh to remote machine,do I configure the firefox on remote machine or local machine? then do i launch firefox over ssh on remote machine ? Please be little elaborate here(am kind of newbie for linux) – Pranay Agarwal Jan 28 '12 at 17:44
-
1Multiposted on Unix & Linux. Please don't do this. – Gilles 'SO- stop being evil' Jan 28 '12 at 22:11
-
Welcome to Ask Ubuntu! This question should instead be filed as a bug report, thanks! Instructions here. – Jorge Castro Feb 03 '12 at 00:44
2 Answers
3
With firefox , you are better off using a tunnel
ssh -D 8080 -CfN user@server
-D flag sets up dynamic port forwarding
-C uses compression
-f puts ssh into the background
-N Do not execute a remote command (useful for tunnels)
See man ssh for details
You then configure Firefox to use socks5 on localhost port 8080
Under preferences -> advanced -> network tab
To close the tunnel, use
killall ssh

Panther
- 102,067
-
This is the response when i do ssh your way bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 8080 Could not request local forwarding. – Pranay Agarwal Jan 28 '12 at 17:49
-
well I tried like dozens of other(>1024) ports.either there is just no response(just returns to terminal shell) or the address is already taken ! – Pranay Agarwal Jan 28 '12 at 18:00
-
i used killall ssh . But nothing has changed. when i give command to ssh.it asks for password and it just returns to terminal after i give the password :( .please help me out here.. Can we talk over chat ? – Pranay Agarwal Jan 28 '12 at 18:11
-
You are not understanding the instructions I gave you. The options -Nf put ssh into the background. You can then close the terminal if you wish. If you want to see the ssh connection or use commands, use ssh without the -Nf
ssh -D 8080 -C user@server
, but if you do that you can not close the terminal. – Panther Jan 28 '12 at 19:06
1
To run a remote X application through ssh, and free up the console where you run the command:
ssh -fX user@host Xapp
where Xapp is the remote X application. In case of Firefox you need the option -no-remote
ssh -fX user@host firefox -no-remote
Some information about the -f
option:
-f Requests ssh to go to background just before command execution.
This is useful if ssh is going to ask for passwords or
passphrases, but the user wants it in the background. This
implies -n. The recommended way to start X11 programs at a
remote site is with something like ssh -f host xterm.

enzotib
- 93,831
-
That works as well. do you have an opinion as to if it is better to tunnel with firefox ? – Panther Jan 28 '12 at 19:28
-
@bodhi.zazen: probably better the tunnel, because the graphic interface do not travel on the network. – enzotib Jan 28 '12 at 20:29