One effective way of securing SSH access to your cloud server is to use a public-private key pair. This means that a public key is placed on the server and the private key is placed on your local workstation. Using a key pair makes it impossible for someone to log in by using just a password, as long as you set up SSH to deny password-based authentication.
Use PuTTYgen to generate your public and private keys. Download PuTTYgen from the PuTTY download page. (PuTTYgen might have been installed previously with PuTTY or WinSCP.)
- Launch the program, and then click the Generate button. The program generates the keys for you.
- Enter a unique key passphrase in the Key passphrase and Confirm passphrase fields, or leave it empty in order not to use the passphrase.
- Save the public and private keys by clicking the Save public key and Save private key buttons. From the Public key for pasting into OpenSSH authorized_keys file field at the top of the window, copy all the text (starting with ssh-rsa) to your clipboard by pressing Ctrl-C. You need this key available on your clipboard to paste either in the Client Area or directly into the authorized keys section on your Kronos Cloud Server.
Unix-like operating systems:
This applies to macOS, Linux and other unix-like OS. As an example, we will be using macOS during this part of the guide.
- First, you will need to access the Terminal. You can find it via Search.
- Enter the following command in the Terminal window: ssh-keygen -t rsa
- Now you will have to choose a file path where your keys will be saved. You can specify a path: /path/to/file/filename or you can simply press Enter and it will use default path and file name, which is /Users/youruser/.ssh/id_rsa. We recommend using the default one.
- At this point, it is possible to setup a password for your key pair. You can write in your desired password or you can press Enter to leave the field blank and not use a password.
- After the last step, your Private and Public keys will be generated in the specified directory.
- You can locate and open your keys to see them in a text format. Public key will have .pub extension and you will upload this key to your remote server. However, make sure not to share your private key with anyone.
Use the key pair
You can use the RSA key pair in the following ways.
Add a new public key to the list
In the Terminal, go to your server's dashboard and then to the Security tab, there you will find your SSH Keys. Click Add Key. Enter the key label and then paste the entire public key into the Public key field. If you mark it as default, the current and all future machines will be assigned this key. Then click Yes. Go back to the Security tab and confirm that your key is listed in the SSH Key list.