ssh X11 forwarding after forgetting -X

1

Is there a way to tell an already-running ssh session to forward X11 connections, if you've forgotten to supply -X on the command line? If so, how?

echristopherson

Posted 2012-07-21T19:25:03.010

Reputation: 771

Answers

1

Not really; you'll want to disconnect and reconnect.

If you want to forward X sessions most of the time, then consider a bash alias such as:

alias ssh="ssh -X"

You can also set it permanently in ~/.ssh/config by setting ForwardX11 yes.

Michael Hampton

Posted 2012-07-21T19:25:03.010

Reputation: 11 744

I was afraid of that. I tried setting up port forwardings from within ssh by using the escape character ~ after a newline, but I had no way to set up the Xauthority stuff. The main reason I haven't made such an alias until now is that every time I use ssh -X on Mac OS X, it delays for several seconds while it starts Xquartz at the beginning of the session. Since I don't usually need X I prefer not to forward it all the time. – echristopherson – 2012-07-21T22:57:16.027