How to secure your linux – Public key authentication

H

Why the fuss about security?

Linux is secure by default but the multitude of options at your disposal are plenty and rather loose or very customizable. Some basic options do not work out of the box but there is nothing preventing you to enable them.

Public key authentication

It is the most basic and simple way to login via SSH but it’s not uncrackable. The best way by far is using Public Key Authentication. To get your own Public Key, checkout this article.

Once you have you own key, download and install Putty. Open Putty and go to Connection > SSH > Auth > “Private key file for Authentication:” > Browse. Now that your private key is being used, any linux machine which has you public key installed should connect effortlessly but this is not all. While logged in your linux machine, you can disable password authentication completely.

It can be disabled by running the following commands:

nano /etc/ssh/sshd_config

Scroll down to “#PasswordAuthentication yes” and replace it with:

PasswordAuthentication no

Restart the SSH server for the settings to be loaded:

service sshd restart

You can store your Public Key anywhere you wish as without the Private one, is of no use.
Take extra care when storing or using your PRIVATE KEY as loosing or sharing it by any means is almost surely gonna render it useless.

About the author

By mvps

Recent Posts

Archives

Categories