Friday, January 20, 2012

ssh config file to different machine, user, port

Normally we may have different account at different machine, including different user name or port.

When default ssh run, it will use your user name as default connection user name, and also port 22 for remote port.

We may use ssh -l login_name to overwrite user name, and ssh -p port to overwrite port number.

We may also have below text inside .ssh/config file to default some useful connection :

Host Home
User neo
Port 1234
HostName neozone.com

Host Office
User neo_wong
Port 13579
HostName hellocompany.com

So that when we use ssh Home, it will equal to :

ssh -l neo -p 1234 neozone.com

It dont have have all field exist :

User neo

equal to :

ssh -l neo

* man page of ssh_config http://linux.die.net/man/5/ssh_config

No comments: