Beginner LevelLinux Commands & SysAdmin
How does SSH (Secure Shell) authentication work using ssh-keygen and ~/.ssh/authorized_keys?
❓ Interview Prompt: Explain SSH public-key cryptography, ssh-keygen, copying public keys (ssh-copy-id), and ~/.ssh/config customization.
SSH (Secure Shell) provides encrypted remote terminal access over public-key cryptography:
Key Authentication Workflow:
1
Generate RSA/Ed25519 key pair: 'ssh-keygen -t ed25519'.
2
Copy public key ('id_ed25519.pub') to remote server: 'ssh-copy-id user@remote-host'.
3
Remote server appends public key to '~/.ssh/authorized_keys'.
4
Future SSH logins authenticate passwordlessly using private key!
Code Implementation Example
bash
# Generate secure Ed25519 SSH key pair
ssh-keygen -t ed25519 -C "admin@company.com"
# Copy public key to remote server for passwordless login
ssh-copy-id -i ~/.ssh/id_ed25519.pub deploy@192.168.1.100💡Generating Ed25519 SSH key pairs and configuring passwordless logins.
🎯 Interview Key Takeaway
Use Ed25519 SSH keys and ssh-copy-id to configure secure passwordless SSH authentication.
#SSH#ssh-keygen#authorized_keys#Security#Beginner
Back to all Linux Commands & SysAdmin Questions→