A common little problem in my daily work is to log on to another machine with a cryptic filename, e.g. machine007.domain.com. First I have find out, that the web server is on that machine. How easy would it be to type just
ssh webserver! The sysadmins don’t want to put this neither into the name service nor into
/etc/hosts. But there is help.
I created a file
config in the directory
.ssh in the home directory. The content is (e.g.):
Host webserver Hostname machine007.domain.com
Now all I have to do is
and ssh connects to machine007.domain.com.
Another goodie: if you need another username on the remote machine you can include it in the config file:
Host webserver Hostname machine007.domain.com User applicuser
Now the command
Of course you have to provide (and remember) the password. This can be avoided with ssh keys (which will come in a later post).
scp uses this file, too. Helpful if you have copy files for patches to or log files from the remote machine(s).