Improving SSH security
SSH is one of the most common techniques to access Raspberry Pi over the network and it becomes necessary to use if you want to make it secure.
Username and password security
Apart from having a strong password, we can allow and deny access to specific users. This can be done by making changes in the sshd_config
file. Run the sudo nano /etc/ssh/sshd_config
command.
This will open up the sshd_config
file; then, add the following line(s) at the end to allow or deny specific users:
- To allow users, add the line:
AllowUsers tom john merry
- To deny users, add this line:
DenyUsers peter methew
For these changes to take effect, it is necessary to reboot the Raspberry Pi.
Key-based authentication
Using a public-private key pair for authenticating a client to an SSH server (Raspberry Pi), we can secure our Raspberry Pi from hackers. To enable key-based authentication, we first need to generate a public-private key pair using tools called PuTTYgen for Windows and ssh-keygen for Linux....