Password Based vs Key Based Authentication : Which is More Secure for Your Linux server?
Aman Reddy
Research Scientist - IT | SAMEER - MeitY, Government of India | Software Developer 2+ Years of Experience
Abstract
In the world of technology, attackers are constantly trying to gain unauthorized access to the server. Because of this, security is a major concern and choosing the best way to protect the server can be challenging. This article will help you to understand password based and key based authentication methods to improve your security.
what is password based authentication ?
Password-based authentication is a method where users prove their identity by entering a password. The password is usually stored and transmitted in an encrypted or hashed form to enhance security.
But the security is a major concern with Password based authentication because password based authentication can be vulnerable to attacks like brute force, where attackers try many passwords until they find the right one.
Passwords are often stored in a hashed format to improve security, but they can still be compromised if the hash is cracked.
what is brute force attack ?
A brute force attack is attack where attackers used some tools and wordlist (consist of combination of passwords ) to gain unauthorized access to the server.
These attacks are more effective against systems with weak or simple passwords.
How to Protect From brute force attack ?
what is Key based authentication ?
Key based authentication is a mechanism where Users authenticate and login using a pair of cryptographic keys public key and a private key.
The public key is shared with the server ( host machine ) , while the private key is kept secret by the user ( client machine ).
How Key based authentication works?
ssh-keygen -t rsa // Generate Private and Public key
cd ~/.ssh // Check Public key and private key
ssh-copy-id user@server_IP // Copy Public Key to the server where you want to login.
~/.ssh/authorized_keys // check public key if not copy
ssh user@server_IP // Access Server via ssh
领英推荐
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
what is SSH (secure remote access)?
SSH (secure remote access) SSH is a network protocol Run on default port 22 used to securely access server & client. It provides a secure channel for communication between a client and a server over an unsecured network. using ssh you can Perform task like remote login , file transfer , command execution on a remote server etc.
SSH (secure remote access) Configuration
Step 1 Server side :
sudo apt update
sudo apt install openssh-server
sudo nano /etc/ssh/sshd_config // note : nono is text editor in Linux.
Disable Password Authentication : PasswordAuthentication no
Allow/Disallow Root Login : PermitRootLogin no (best practice to protect Linux server
from brute force attack )
Step 2 Client side :
sudo apt update
sudo apt install openssh-client
sudo ssh -p Your_PORT username@server_ip
if you have any query drop comment I am happy to help you Aman Reddy
"Devops Engineer| Actively Looking for Devops engineer role | Software testing | Manual testing | Functional Testing | JIRA | SQL"
7 个月Insightful!
Test Engineer | EV domain | Software QA Automation | Selenium WebDriver | TestNG | Manual Testing | Mobile Testing | APPIUM | DevOps | Jenkin
7 个月Thanks for sharing