🔐 Setting Up SSH Key for Secure VPS Access
AstroStake recommends using SSH keys instead of passwords for improved security and ease of access when managing your node infrastructure.
This guide will walk you through the process of creating and using SSH keys to access your VPS.
Prerequisites
Make sure you have:
- A local machine (Linux, macOS, or Windows with WSL)
- Access to your VPS (IP address and login credentials)
Step 1: Generate Your SSH Key
Run the following command on your local machine:
ssh-keygen -t ed25519 -C "your_email@example.com"
Press Enter
to accept the default file location (recommended), and set a passphrase if you'd like extra protection.
Your keys will be saved to:
- Private key:
~/.ssh/id_ed25519
- Public key:
~/.ssh/id_ed25519.pub
🧠 Never share your private key (
id_ed25519
) with anyone.
Step 2: Upload Your Public Key to the VPS
Replace username
and vps_ip
with your actual values:
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@vps_ip
If ssh-copy-id
is not available, you can do it manually:
cat ~/.ssh/id_ed25519.pub
Then, SSH into your VPS and paste the key into ~/.ssh/authorized_keys
.
Step 3: Secure Your VPS (Optional but Recommended)
Edit your VPS SSH configuration:
sudo nano /etc/ssh/sshd_config
Update this setting to disable password login:
PasswordAuthentication no
Then restart SSH:
sudo systemctl restart sshd
⚠️ Make sure your SSH key is working before disabling password login.
To disable root login safely, follow this separate guide:
👉 Disable Root Login (Safely)
Step 4: Connect Using SSH Key
Now you can log in with your key:
ssh username@vps_ip
If your key has a passphrase, you’ll be prompted to enter it.
Optional: Use SSH Config for Easier Access
Create or edit your SSH config file:
nano ~/.ssh/config
Example entry:
Host astrovps
HostName vps_ip
User username
IdentityFile ~/.ssh/id_ed25519
Now you can connect simply by running:
ssh astrovps
✅ Done!
You’ve secured your VPS with SSH key authentication. Keep your private key safe, and consider backing it up in a secure location.
If you run into issues, feel free to reach out in our community channels or DM @AstroStake on X.
Built by Node Runners.
For the Networks We Believe In.
🌐 astrostake.xyz