SSH Key Management¶
Overview¶
SSH keys are used for secure authentication with servers, Git repositories, and other services. At Lemone, we primarily use 1Password SSH Agent for secure key storage and management.
Modern Approach: 1Password SSH Agent¶
Note
Recommended: Use 1Password SSH Agent for secure, convenient SSH key management.
Benefits¶
- Secure storage: Keys stored encrypted in 1Password vault
- No local key files: Keys never written to disk
- Cross-device sync: Access keys on all your devices
- Automatic signing: Git commits automatically signed
- Touch ID support: Biometric authentication for key usage
Setup¶
Step 1: Enable SSH Agent in 1Password
- Open 1Password
- Go to Preferences → Developer
- Enable "Use the SSH agent"
- Enable "Display key names when authorizing connections"
Step 2: Configure SSH to Use 1Password
Edit ~/.ssh/config:
On Linux:
Step 3: Store SSH Keys in 1Password
- Generate a new SSH key or import existing one
- Store in 1Password with:
- Title: "SSH Key - GitLab" (or appropriate service)
- Username: Your email or username
- Private key: Paste or generate
- Public key: Automatically generated
Step 4: Test Connection
# Test GitLab
ssh -T git@codepot.nl
# Test Exonet
ssh web01.exonet.lemone.network
# Test Kinsta
ssh -p PORT user@host.kinsta.cloud
Managing Multiple Keys¶
1Password SSH Agent automatically provides the correct key based on the host.
To see which keys are available:
Resources¶
Legacy Approach: Manual SSH Key Management¶
Warning
Deprecated: This manual approach is no longer recommended. Use 1Password SSH Agent instead.
Switching Between SSH Keys Manually¶
If you need to temporarily switch between different SSH keys:
Step 1: Navigate to SSH Directory
Step 2: Remove Currently Registered Keys
Step 3: Add Specific Key
# Add Exonet deploy key
ssh-add exonet_deploy_key
# Add GitLab key
ssh-add id_ed25519_gitlab
# Add personal key
ssh-add id_ed25519
Step 4: Verify Added Keys
Note: You'll need to repeat these steps when switching between different keys for different services.
Generating SSH Keys¶
Modern (Ed25519)¶
Recommended: Ed25519 keys are more secure and shorter than RSA.
Legacy (RSA)¶
Only use if Ed25519 is not supported:
Best Practices¶
- Use a passphrase: Always protect your private key with a strong passphrase
- Store in 1Password: Never leave unencrypted keys on disk
- One key per service: Create separate keys for different services (GitLab, Exonet, etc.)
- Descriptive names: Use clear names like
id_ed25519_gitlab,exonet_deploy_key
Adding SSH Keys to Services¶
GitLab (codepot.nl)¶
-
Generate or copy public key:
-
Log in to codepot.nl
- Go to User Settings → SSH Keys
- Paste public key
- Add descriptive title (e.g., "MacBook Pro M2 - 2024")
- Click Add key
GitHub¶
- Copy public key
- Go to github.com/settings/keys
- Click New SSH key
- Paste public key and save
Exonet Server¶
# Copy public key to server
ssh-copy-id user@web01.exonet.lemone.network
# Or manually:
cat ~/.ssh/id_ed25519.pub | ssh user@web01.exonet.lemone.network "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Kinsta¶
- Log in to MyKinsta
- Go to Sites → Your Site → Info
- Find SFTP/SSH section
- Click Add public key
- Paste public key
SSH Config¶
Create ~/.ssh/config for easier SSH access:
# GitLab
Host codepot codepot.nl
HostName codepot.nl
User git
IdentityFile ~/.ssh/id_ed25519_gitlab
IdentitiesOnly yes
# Exonet
Host exonet web01 web01.exonet.lemone.network
HostName web01.exonet.lemone.network
User your-username
IdentityFile ~/.ssh/id_ed25519_exonet
IdentitiesOnly yes
# Kinsta
Host kinsta-site1
HostName site.kinsta.cloud
Port 12345
User site-user
IdentityFile ~/.ssh/id_ed25519_kinsta
IdentitiesOnly yes
Usage:
# Instead of: ssh user@web01.exonet.lemone.network
ssh exonet
# Instead of: ssh -p 12345 user@site.kinsta.cloud
ssh kinsta-site1
Troubleshooting¶
Permission Denied (publickey)¶
Check key permissions:
Verify key is loaded:
Test connection with verbose output:
SSH Agent Not Running¶
Start SSH agent (if not using 1Password):
For persistent agent (add to ~/.zshrc or ~/.bashrc):
Wrong Key Being Used¶
Use specific key:
Clear all keys and add specific one:
Security Best Practices¶
- Never share private keys: Only share public keys (.pub files)
- Use passphrases: Always protect private keys with strong passphrases
- Store in 1Password: Don't leave unencrypted keys on disk
- Rotate regularly: Update keys periodically (yearly recommended)
- Remove old keys: Delete unused keys from services
- Use separate keys: Don't reuse the same key across services
- Monitor usage: Check GitLab/GitHub for unexpected key usage
See Also¶
- Git Development Guide - Git configuration and SSH signing
- GitLab - GitLab server management
- Exonet Hosting - Exonet server access
- Kinsta Hosting - Kinsta SSH access