SSH Keys
Updated March 25, 2025
SSH keys provide secure access to your instances without using passwords. They are essential for secure remote management of your cloud resources.
Understanding SSH Keys
What are SSH Keys?
- Public/private key pair
- Public key: Stored on the server
- Private key: Kept secure on your local machine
- Used for secure authentication
Key Types
-
RSA Keys
- Traditional and widely supported
- Recommended size: 4096 bits
- Example:
ssh-keygen -t rsa -b 4096
-
Ed25519 Keys
- Modern and more secure
- Shorter key length
- Example:
ssh-keygen -t ed25519
Features
Secure Authentication
- No password required
- Resistant to brute force attacks
- Supports key rotation
# Example: SSH connection
ssh -i ~/.ssh/my_key.pem ubuntu@instance-ip
Multiple Key Support
- Different keys for different purposes
- Project-specific keys
- Role-based access
# Example: Using multiple keys
ssh -i ~/.ssh/project1_key.pem ubuntu@project1-server
ssh -i ~/.ssh/project2_key.pem ubuntu@project2-server
Key Management
- Easy addition and removal
- Key naming and organization
- Instance association
# Example: Adding a key to Cloudtop
Name: project1-key
Type: RSA 4096
Purpose: Production server access
Key Management
Generating Keys
-
Using ssh-keygen
# Generate RSA key ssh-keygen -t rsa -b 4096 -f ~/.ssh/my_key # Generate Ed25519 key ssh-keygen -t ed25519 -f ~/.ssh/my_key
-
Key File Permissions
# Set correct permissions chmod 600 ~/.ssh/my_key chmod 644 ~/.ssh/my_key.pub
Adding Keys to Cloudtop
- Generate key pair
- Copy public key
- Add to Cloudtop dashboard
- Associate with instances
Managing Keys
- View all keys
- Update key names
- Remove unused keys
- Associate with instances
Best Practices
Key Generation
-
Strong Keys
- Tip: Use 4096-bit RSA or Ed25519
- Warning: Weak keys are vulnerable
-
Unique Keys
- Tip: One key per purpose
- Warning: Reusing keys increases risk
Key Storage
-
Local Security
- Tip: Use SSH agent
- Warning: Unencrypted keys are vulnerable
-
Backup Strategy
- Tip: Secure backup of private keys
- Warning: Lost keys mean lost access
Key Rotation
-
Regular Updates
- Tip: Rotate keys every 90 days
- Warning: Old keys may be compromised
-
Emergency Rotation
- Tip: Have backup keys ready
- Warning: No access during rotation
Security Tips
Key Protection
- Use SSH agent
- Set correct permissions
- Encrypt private keys
- Use key passphrases
Access Control
- Limit key usage
- Monitor access patterns
- Implement key expiration
- Use role-based access
Monitoring
- Track key usage
- Review access logs
- Set up alerts
- Regular audits
Common Issues and Solutions
Connection Problems
-
Permission Issues
# Fix permissions chmod 600 ~/.ssh/my_key chmod 644 ~/.ssh/my_key.pub
-
Key Format
# Convert key format ssh-keygen -p -f ~/.ssh/my_key
Key Management Issues
-
Lost Keys
- Tip: Keep secure backups
- Warning: Recovery may require support
-
Compromised Keys
- Tip: Immediate rotation
- Warning: Previous access may be logged
Getting Help
Resources
- Documentation: Detailed guides
- Support: Technical assistance
- Community: User forums
- Security Team: Security concerns
Contact Information
- Support Email: [email protected]
- Security Email: [email protected]
- Emergency Contact: +1-XXX-XXX-XXXX