You can add a bit of extra security to your server by disabling SSH password authentication altogether, and instead using a pre-generated, private key. Note that if you lose said key, you’ll lose remote access to your server. In order to do this, take the following steps:
- Open your sshd_config file, and look for the line #PasswordAuthentication. Change the flag from yes to no.
- Run the command ssh keygen on your machine to generate a public and private key.
- Copy the public key information over to your remote host. Note that during this process, you may need to create a directory in which to store it, such as ~/.ssh.
- Depending on your version of SSH, you may also need to put the public key in .ssh/authorized_keys2, change the permissions of .ssh to 700, or change the permissions of .ssh/authorized_keys2 to 640.
From here, you can use ssh-agent to securely save your key, eliminating the need to enter it every time you login. You can read more about this utility here.Follow Liberty Center One: