Setting Up SSH on Linux
Learn how to set up secure SSH access on your Linux server with advanced configuration options.
- Install OpenSSH server:
sudo apt install openssh-server
- Configure SSH with enhanced security:
sudo nano /etc/ssh/sshd_config
Set these recommended options:
PermitRootLogin no
PasswordAuthentication no
AllowUsers yourusername
- Generate SSH keys:
ssh-keygen -t ed25519 -C "[email protected]"
- Restart SSH service:
sudo systemctl restart ssh
- Test connection with key-based authentication:
ssh -i ~/.ssh/id_ed25519 user@your-server-ip
Additional security measures:
- Use fail2ban to prevent brute force attacks
- Implement two-factor authentication
- Regularly update SSH packages
- Monitor SSH logs for suspicious activity
Read more: OpenSSH Documentation