Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Re-establish X11 forwarding after upgrade UNIX
I noticed that when I upgraded to Panther, my X11 forwarding configuration in /etc/ssh_config was disabled. Re-enabling is easy enough:
  1. Using Terminal.app or X11 xterm, open /etc/ssh_config with your favorite editor. You'll have to be a super user to edit this file. Example:
    [marley:~] lizard% sudo emacs /etc/ssh_config
    
  2. Find the line that contains ForwardX11

  3. Remove the leading # if it exists. This will uncomment this line so the ssh daemon will actually use this parameter instead of the default.

  4. Change the line to ForwardX11 yes

  5. Save your changes and exit the editor.
I believe you'll have to restart sshd for the changes to take effect. Once restarted, you should be able to ssh to your machine and forward X11 clients, as discussed in this previous hint:
 % ssh -X user@server.foo.com
    •    
  • Currently 1.57 / 5
  You rated: 2 / 5 (7 votes cast)
 
[11,722 views]  

10.3: Re-establish X11 forwarding after upgrade | 6 comments | Create New Account
Click here to return to the '10.3: Re-establish X11 forwarding after upgrade' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Re-establish X11 forwarding after upgrade
Authored by: aranor on Jan 30, '04 11:34:15AM
You don't have to restart sshd. sshd is the daemon that serves incoming ssh connections, but the ssh_config file controls outgoing ssh connections. If you don't want to edit ssh_config you can edit ~/.ssh/config and include the same thing. Also, you can include per-host config, such as the username to use for that host, or host aliases. For example, I have an entry for sourceforge.net and it redirects to shell.sourceforge.net with the username aranor.

[ Reply to This | # ]
10.3: Re-establish X11 forwarding after upgrade
Authored by: zojas on Jan 30, '04 12:47:49PM

hold on there. the /etc/ssh_config file only controls when you are on the local machine and sshing to a remote host. turning on X forwarding in /etc/ssh_config will forward a connection to your local X server, you can run commands on the remote machine and display them locally.

the /etc/sshd_config file controls the local sshd, for when you are on another machine and you want ssh back into this one. X forwarding in this file allows you to ssh into this machine, run X clients on this machine, and see them on the remote machine you sshed in from.



[ Reply to This | # ]
10.3: Re-establish X11 forwarding after upgrade
Authored by: Lizard_King on Jan 30, '04 06:31:24PM
Thanks for posting this... there's a big difference between ssh_config and sshd_config. Hopefully my typo hasn't caused anyone frustration. sshd_config y'all!

[ Reply to This | # ]
10.3: Re-establish X11 forwarding after upgrade
Authored by: MattHaffner on Jan 30, '04 04:34:19PM

You don't need the '-X' if you set this parameter to 'yes'. That's the point of it actually ;) Instead, if you want to *not* forward for a particular host, you can use '-x' (lowercase) if you've set the global flag.

And, as another poster has already pointed out, it's probably a better idea just to use ~/.ssh/config . That way, future upgrades/fixes won't clobber your changes. Many unix-y programs work this way and it's good to start taking advantage of the separation of the user and system space that OS X gives you whenever you can, even if you are the sole user on the machine.



[ Reply to This | # ]
10.3: Re-establish X11 forwarding after upgrade
Authored by: The Gonif on Jan 31, '04 02:42:08PM

Thanks for the tips!

If you don't already have a ~/.ssh/config file and have to create one, do you base it on the entire /etc/ssh_config file, or can ~/.ssh/config just contain the non-default options?

Also, is there a ~/.sshd/config file?



[ Reply to This | # ]
10.3: Re-establish X11 forwarding after upgrade
Authored by: MattHaffner on Feb 02, '04 12:55:10AM

No, you don't need to copy the system-wide file. Your options will override any in the system file. And, any command line options you specify override will override both files.

There is no .ssh/sshd_config or such. Those options really do belong to the system and don't make sense for a per-user configuration. They contain a lot of restrictions on how ssh connections can occur and what they can do. You wouldn't want a user to be able to override those values. There are a few useful files you can put in the .ssh directory of the destination machine that will affect incoming sessions like .ssh/environment for automatically setting environment variables and .ssh/rc for automatically running a script on your ssh login.

Session-based ssh variables need to be set in the .ssh/config file of the machine you're ssh-ing from. You can restrict a set of options for a particular destination host (and have different ones for different hosts) by using the 'Host' keyword on a line in your config file.

More help can be found in:

man ssh_config
man sshd (see the FILES section for info about the environment & rc files)

from a Terminal session.



[ Reply to This | # ]