How to SSH into a Droplet on DigitalOcean
Gather your Droplet's IP, username (root), and SSH keys or password from the DigitalOcean Control Panel. Use <code>ssh root@your_droplet_ip</code> in terminal to connect securely on port 22. Prefer SSH keys for passwordless, secure access; use Recovery Console if locked out.
Prerequisites
- Access to DigitalOcean Control Panel at cloud.digitalocean.com
- Your Droplet's IPv4 address from the Droplets page
- Default username (usually root) or custom user
- SSH client installed (OpenSSH on Linux/macOS, PuTTY on Windows)
- SSH keys (recommended) or root password
Step-by-Step Instructions
Gather Droplet Information
root for most Droplets like Ubuntu or CentOS.[1][4]Set Up Authentication (SSH Keys Recommended)
ssh-keygen if needed (OpenSSH on Linux/macOS/WSL, PuTTY on Windows). Password authentication is an alternative but less secure; set during creation.[1][2]Install SSH Client
CTRL+ALT+T on Linux or Spotlight on macOS). Windows: Use OpenSSH in PowerShell or download PuTTY.[1][4]Open Terminal and Run SSH Command
CTRL+ALT+T), macOS (Spotlight > Terminal), Windows (PowerShell). Run ssh root@your_droplet_ip replacing your_droplet_ip with the IPv4 (e.g., ssh root@203.0.113.0). Default port is 22; for non-root: ssh username@your_droplet_ip. Specify key if needed: ssh -i /path/to/private_key root@your_droplet_ip.[1][4]Verify Host Authenticity
The authenticity of host '203.0.113.0 (203.0.113.0)' can't be established.
ECDSA key fingerprint is SHA256:IcLk6dLi+0yTOB6d7x1GMgExamplewZ2BuMn5/I5Jvo.
Are you sure you want to continue connecting (yes/no)? Type yes and press ENTER to add the host to known_hosts.[4]Authenticate and Connect
root@droplet-hostname:~# prompt with OS welcome.[1][4]Fix Host Key Conflicts
ssh-keygen -R your_droplet_ip to remove old entry, then reconnect.[4]Alternative: Use DigitalOcean CLI (doctl)
doctl. Generate token at API > Tokens > Personal access tokens. Run doctl auth init (paste token). Connect with doctl compute ssh droplet-id-or-name (find ID/name in Droplets page).[1]Access via Recovery Console (No SSH)
Verify SSH Service and Firewall
systemctl status ssh or service ssh status. Check port in grep Port /etc/ssh/sshd_config.[2]Common Issues & Troubleshooting
Permission denied (publickey/password)
Verify IP, username, password, or key path. On Droplet, check <code>~/.ssh/authorized_keys</code> has 600 perms (<code>chmod 600 ~/.ssh/authorized_keys</code>), <code>~/.ssh</code> has 700 (<code>chmod 700 ~/.ssh</code>). Reset password via Recovery Console.[5]
Firewall blocking port 22
Ubuntu: <code>ufw status</code>, allow with <code>ufw allow 22</code>. CentOS: <code>firewall-cmd --list-all</code>. Ensure INPUT chain allows SSH; check cloud firewall too. Reboot Droplet if needed.[2]
Connection refused
Confirm Droplet powered on in Control Panel. Restart SSH: <code>systemctl start sshd</code> or <code>service ssh start</code>. Verify service binds to port 22.[2]
Incorrect IP or DNS issues
Double-check IPv4 in Control Panel. Use IP directly (<code>ssh root@IP</code>) instead of domain. ISP IP change? Update firewall rules.[2]
SSH service not running
Check status: <code>systemctl status sshd</code>. Restart: <code>systemctl restart sshd</code>. Use Recovery Console for access.[2]