How do I setup a SSH Connection?
TABLE OF CONTENTS
- Why should I setup a SSH connection?
- What You Need Before Starting
- How do I setup a SSH connection on Windows?
- How do I setup a SSH connection on Linux?
- How do I setup a SSH connection on Mac?
- Common Questions
- Summary
Why should I setup a SSH connection?
SSH (Secure Shell) allows you to securely access and manage your server remotely.
By default, many servers allow password-based login. While this works, using SSH key authentication instead of passwords significantly increases security because:
A private key is nearly impossible to brute-force.
Your password is never transmitted.
Automated login attempts fail without the private key.
You can disable password login entirely.
What You Need Before Starting
Your server’s IP address
Your username (e.g.,
rootor another user)Access to your local computer’s terminal or SSH client
How do I setup a SSH connection on Windows?
Modern Windows 10 and 11 include built-in OpenSSH.
1. Open PowerShell
Press:
Windows Key → Type "PowerShell" → Open

2. Generate an SSH Key
Run:
ssh-keygen -t ed25519

Press Enter to accept the default file location.
You will be prompted to set a passphrase. We strongly recommend setting one.

This creates:
Private key:
C:\Users\YOUR_USER\.ssh\id_ed25519Public key:
C:\Users\YOUR_USER\.ssh\id_ed25519.pub

3. Upload the public key to your server
Run:
ssh-copy-id USERNAME@SERVER_IP
If your server uses a custom SSH port:
ssh-copy-id -p PORT USERNAME@SERVER_IP
If ssh-copy-id is not available, you can manually copy your public key:
type $env:USERPROFILE\.ssh\id_ed25519.pub
Copy the output and paste it into:
~/.ssh/authorized_keys
on your server.
4. Connect to your server
ssh USERNAME@SERVER_IP
If using a custom port:
ssh -p PORT USERNAME@SERVER_IP
How do I setup a SSH connection on Linux?
Linux systems include SSH by default.
1. Open Terminal
2. Generate an SSH Key
ssh-keygen -t ed25519
Press Enter to accept defaults.
Your keys will be stored in:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
3. Upload the Public Key
ssh-copy-id USERNAME@SERVER_IP
For custom port:
ssh-copy-id -p PORT USERNAME@SERVER_IP
4. Connect
ssh USERNAME@SERVER_IP
How do I setup a SSH connection on Mac?
macOS includes SSH by default. No additional software is required.
1. Open terminal
Press:
Cmd + Space → Type "Terminal" → Open
2. Generate an SSH key
Run:
ssh-keygen -t ed25519
Press Enter to accept defaults.
Your keys will be stored in:
~/.ssh/id_ed25519
~/.ssh/id_ed25519.pub
3. Upload the public key to your server
Run:
ssh-copy-id USERNAME@SERVER_IP
If using a custom port:
ssh-copy-id -p PORT USERNAME@SERVER_IP
If ssh-copy-id is not available:
cat ~/.ssh/id_ed25519.pub
Copy the output and manually paste it into:
~/.ssh/authorized_keys
on your server.
4. Connect to your server
ssh USERNAME@SERVER_IP
Common Questions
Can I use the same SSH key on multiple servers?
Yes. You can copy your public key to multiple servers.
What happens if I lose my private key?
You will not be able to log in unless another authentication method is available.
Is changing the SSH port required?
No. It can reduce automated scan noise but does not replace proper security practices.
Summary
Setting up SSH key authentication:
Protects your server from brute-force attacks
Removes password vulnerabilities
Provides a secure and industry-standard authentication method
Is strongly recommended for all production environments.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article