Tuesday, September 30, 2008

SSH Remote Connections via Config

Thorsten has contributed the following ssh tip. Thanks Thorsten!

You wrote about ssh connects via gnome terminal:

http://dailyvim.blogspot.com/2008/09/gnome-terminal-tips.html

I'm using the config file of ssh to achieve the same goal:

just put the file "config" in your .ssh directory (chmod 600) with the
following lines:


host mysshhost
user root
identityfile /root/.ssh/my_ssh_key.ssh
port 34021
hostname 127.0.0.1
localforward 10100 localhost:10100
ForwardX11 yes


then back at the command line just try:

myhost:/ # ssh mysshhost

and voila, welcome to your ssh connected system (even the
bash-completion works with the config file, just do a ssh )

1 comment:

Anonymous said...

The config file is key especially when another application invokes ssh but doesn't offer a way to specify all the ssh options you want. For example, subversion doesn't allow you to specify an alternate SSH port when specifying a repository URL, e.g., svn+ssh://user@host:port/svn/repo doesn't work. The config file fixes this nicely.

See the manpage for ssh_config for descriptions of all possible keywords in the ~/.ssh/config file.