Using an SSH Config File
You can easily create short-cuts for servers you are using frequently, by creating a local configuration file for SSH. By using such configuration file, you can configure more advanced options for your SSH connections.
To do this, we will be using a terminal application (default available terminal application for gnome is gnome-terminal, of course you can use guake as well).
Launch your favourite terminal application and check if you have “.ssh” directory under your user’s home directory. If you do not have, you will have to create it. In case you are creating a new directory, it must have access rights 700.
Here is how to do all of the above:
ls ~/.ssh #checking for directory .ssh under your home directory #if the above returns an error mkdir ~/.ssh chmod 700 ~/.ssh |
Then we need to add a file named “config” in that directory
touch ~/.ssh/config |
Use your favourite editor to add information to that file. I usually use ‘nano’.
nano ~/.ssh/config |
You can add your options in the file, here is a common set of options:
Host remoteserver
HostName remote.server.tld
User remoteuser
Port 12345 |
This will help you to connect to remote.server.tld with user remoteuser on port 12345 by issuing the command
ssh remoteserver |
If you have added password-less login (with rsa key pairs), issuing the command will log you in straight into the remote box with the desired username.