I have a Linux server where I connect to via ssh. It works fine, and also, X-forwarding works fine (in the local network).

Now I wanted to run a server program under wine. because it's a Windows application, it doesn't run on the command line, so I have to start it via x-forwarding. So far not a problem, works wonderfully.

My problem is I connect to the target computer with X-forwarding, like this:
ssh ip.of.target.computer -X

then I start


from the ssh terminal. Gnome loads and i can start the graphical server application via wine. But when I want to logout from the X-forwarding, that closes the gnome-session (and the server X-window-application)...

How can I login, start a X-window application, and then logout ssh without closing the X-application ?


You might find the -N option useful:

 -N      Do not execute a remote command.  This is useful for just for‐
         warding ports (protocol version 2 only).

and/or the -T option:

 -T      Disable pseudo-tty allocation.

That way you won't get a shell prompt.

Try combining it with disown.

ssh <host> -X -N -T &
disown %<number>

where <number> is whatever number is printed in bracket after running the ssh command.

For example:

$ ssh -X -N -T myserver&
[1] 10317
$ disown %1

That will detach ssh from the shell and window, so you can close the window and ssh will keep running.

  • The bottom line is, -N is useless because the server initially is in console mode, not xorg mode. – Quandary Jan 26 '11 at 11:08

You could run X on the remote machine and use x11vnc to manage running apps remotely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.