You may request to provide for you RSA keys instead of passwords for dedicated servers and VPS instances, you ordered from us. This way of authorization is secure for most of operations and we basically recommend to use pair RSA keys.
Connecting with RSA keys is not too complicated, you just have only to define the path to RSA key on your remote computer, connection command for example should be:
$ ssh -i /home/me/.ssh/all-keys/dserv_id_rsa.key -p 4444 -l [email protected]
In this command we defined: url of RSA key, custom port number, login and hostname.
But how to avoid typing all of these ssh command parameters while logging into a remote machine? All you have to do is create an ssh config file.
Let’s see how to work with RSA keys if you are a Mac user and beginner.
Open the Terminal app and create your config file. In Mac OS X it located in Applications > Utilities, or system path: /Applications/Utilities/Terminal.app
In Terminal run commands by doing the following steps.
1. Check your system path at: /Users/marko/.ssh/ for file ‘config’ (yes, without extension).
If it not exists, let’s create it by run command:
By creating a local configuration file for SSH we will provide our RSA keys for system to authorization.
2. Copy RSA key file to some directory on a remote Mac OS X, for example: .ssh/all-keys/
3. Edit ‘config’ file to enable getting our key file request.
Host demo-server HostName demoserv.en.ee User root Port 4444 IdentityFile /home/me/.ssh/all-keys/dserv_id_rsa.key
4. Additional options
You can add even more options directly below these entries. You may make sure your session stays always alive while you out of your computer. The following syntax will refresh your connection every 30 seconds for a maximum of one hour:
ServerAliveInterval 30 ServerAliveCountMax 120
5. Now we may connect via SSH with Terminal App:
We have a defined host directive in config, so you may simply connect by typing:
$ ssh demo-server
or in ‘old-school’ style:
$ ssh -i /home/me/.ssh/all-keys/dserv_id_rsa.key -p 4444 -l root demoserv.en.ee