1️⃣ Password Authentication
Users authenticate using a username and password.
✅ Simple to implement
-
❌ Less secure if:
- Weak passwords are used
- Passwords are reused
- Credentials are intercepted
⚠️ Should always be combined with HTTPS/SSH encryption.
Best practice: Enable MFA along with passwords.
2️⃣ Public Key Authentication (SSH Key-Based)
Uses asymmetric cryptography with a key pair:
🔓 Public Key → Stored on server
🔐 Private Key → Stored securely on client
More secure than password authentication.
🔑 SSH Key Generation (Client Side)
ssh-keygen
This generates:
id_rsa→ Private Key (Keep Secret ❗)id_rsa.pub→ Public Key (Shareable)
🖥️ Server Configuration
-
Go to:
~/.ssh/ -
Paste the client’s public key into:
authorized_keys
🔌 Connect to Server
ssh <username>@<server-ip>
Use private IP if inside same VPC
Use public IP if accessing from internet
Test the Connection
ssh -T git@github.com
🔐 Using PEM File (Example: AWS EC2)
When launching an EC2 instance:
You download a .pem file (private key).
AWS stores the corresponding public key on the server.
Connect using:
ssh -i <path-to-pem-file> <username>@<public-ip>
Example:
ssh -i mykey.pem ec2-user@54.x.x.x
📦 SCP (Secure Copy Protocol)
Transfer files securely over SSH:
scp -i <path-to-pem-file> <local-file> <username>@<server-ip>:<remote-directory>
Example:
scp -i mykey.pem app.jar ec2-user@54.x.x.x:/home/ec2-user/
3️⃣ Keyboard-Interactive Authentication
Server sends dynamic authentication prompts.
-
Commonly used for:
- OTP verification
- Multi-Factor Authentication (MFA)
- Security questions
Often integrated with PAM modules in Linux systems.
4️⃣ Biometric Authentication
Uses biological traits for verification:
Fingerprint
Face recognition
Iris scan
✅ Very strong authentication
❌ Requires specialized hardware
Usually combined with password or token for added security.
5️⃣ Token-Based Authentication
Uses a token to authenticate the user instead of (or in addition to) a password.
A token can be:
🔑 Hardware token (USB security key, smart card)
📱 Software token (OTP from mobile app)
🧾 Time-based OTP (like Google Authenticator)
How It Works:
User enters credentials (or initiates login).
System requests a token.
User provides:
* OTP generated by device/app
OR
* Inserts hardware security key.
- Server verifies the token before granting access.
✅ Strong security
✅ Protects against password theft
✅ Commonly used in MFA systems
Top comments (0)