26/06/2026
SSH for Windows, macOS, and Linux
The Complete Beginner-to-Professional Guide
SSH (Secure Shell) is one of the most important technologies in modern computing.
Whether you're managing Linux servers, connecting to a Raspberry Pi, deploying applications to the cloud, administering infrastructure, working with Git and GitHub, automating CI/CD pipelines, or building a home lab, SSH is the industry-standard way to securely access remote systems.
For developers, SSH is much more than a tool for logging into servers. It is also used to authenticate with Git hosting platforms, automate deployments, securely transfer files, create encrypted tunnels, and manage infrastructure at scale.
Think of SSH as a secure remote control for computers. It allows you to connect to another machine across a network or the internet and manage it as if you were sitting directly in front of it.
Learning SSH is one of the most valuable skills for:
- Software Developers
- Linux Administrators
- DevOps Engineers
- Cloud Engineers
- Site Reliability Engineers (SREs)
- Cybersecurity Professionals
- IT Administrators
- Home Lab Enthusiasts
This guide takes you from complete beginner to confidently using SSH on Windows, macOS, and Linux.
---
What Is SSH?
SSH (Secure Shell) is a cryptographic network protocol that provides secure communication between computers.
SSH is commonly used to:
- Log in to remote computers
- Execute commands remotely
- Transfer files securely
- Manage Linux servers
- Access cloud infrastructure
- Authenticate with Git repositories
- Create encrypted tunnels
- Automate deployments
- Manage containers and virtual machines
Without SSH, administrators would often require direct physical access to servers. SSH allows secure management from anywhere in the world.
---
Why SSH Matters
SSH is one of the foundational technologies behind modern computing.
Many popular platforms rely heavily on SSH:
Cloud Platforms
- AWS (https://aws.amazon.com)
- Microsoft Azure (https://azure.microsoft.com)
- Google Cloud (https://cloud.google.com)
- DigitalOcean (https://www.digitalocean.com)
- Linode (https://www.linode.com)
- Vultr (https://www.vultr.com)
Git Hosting Platforms
- GitHub (https://github.com)
- GitLab (https://gitlab.com)
- Bitbucket (https://bitbucket.org)
- Gitea (https://about.gitea.com)
- Forgejo (https://forgejo.org)
DevOps Platforms
- GitHub Actions
- GitLab CI/CD
- Jenkins
- Azure DevOps
- ArgoCD
If you work with Linux, cloud infrastructure, Git repositories, containers, or automation, you will use SSH regularly.
---
How SSH Works
SSH uses a client-server architecture.
SSH Client
The client initiates the connection.
Examples:
- Windows laptop
- MacBook
- Linux workstation
- Development machine
SSH Server
The server accepts the connection.
Examples:
- VPS
- Cloud instance
- Raspberry Pi
- Home lab server
- Linux server
- Remote workstation
Connection Flow
Your Computer (Client)
│
▼
Encrypted SSH Connection
│
▼
Remote Computer (Server)
All communication is encrypted before transmission.
This protects:
- Usernames
- Passwords
- Commands
- Files
- Application data
---
SSH Authentication Methods
SSH supports several authentication methods.
The two most common are password authentication and SSH key authentication.
---
Password Authentication
You provide:
- Username
- Password
Example:
ssh [email protected]
Advantages:
- Simple setup
- Easy to understand
Disadvantages:
- Less secure
- Vulnerable to brute-force attacks
- Often disabled in production environments
---
SSH Key Authentication (Recommended)
SSH keys use public-key cryptography.
A key pair consists of:
Private Key
- Stored on your computer
- Never shared
- Used to prove your identity
Public Key
- Copied to servers
- Safe to share
- Used to verify your identity
Think of it like this:
Private Key = Your House Key
Public Key = The Lock
The server verifies ownership of the private key before granting access.
Advantages:
- More secure
- Faster authentication
- No password guessing attacks
- Required by many organizations
- Preferred for cloud infrastructure
---
Step 1: Install an SSH Client
Most modern operating systems include SSH.
Windows 10 and Windows 11
Open PowerShell:
ssh -V
Expected output:
OpenSSH_for_Windows_9.x
If OpenSSH is not installed:
1. Open Settings
2. Apps
3. Optional Features
4. Add a Feature
5. Install OpenSSH Client
Alternative clients:
- PuTTY
- MobaXterm
- Windows Terminal
For most users, OpenSSH is recommended.
---
macOS
SSH is installed by default.
Verify:
ssh -V
---
Linux
Verify:
ssh -V
Ubuntu and Debian:
sudo apt update
sudo apt install openssh-client
Fedora:
sudo dnf install openssh-clients
Arch Linux:
sudo pacman -S openssh
---
Step 2: Connect to a Server
Basic syntax:
ssh username@server_ip
Example:
ssh [email protected]
Components:
- username = account on server
- @ = separator
- server_ip = server address
---
First Connection Warning
The first connection displays:
The authenticity of host can't be established.
Are you sure you want to continue connecting?
Type:
yes
SSH stores the fingerprint in:
~/.ssh/known_hosts
This helps detect impersonation attempts.
---
Understanding SSH Fingerprints
Every SSH server has a unique fingerprint.
Think of it as the server's digital identity card.
Always verify fingerprints when possible.
This protects against man-in-the-middle attacks.
---
Step 3: Generate SSH Keys
Generate a modern Ed25519 key:
ssh-keygen -t ed25519 -C "[email protected]"
Press Enter to accept the default location.
SSH creates:
id_ed25519
id_ed25519.pub
Private key:
id_ed25519
Never share it.
Public key:
id_ed25519.pub
Safe to share.
---
Step 4: Protect Your Key
Use a passphrase whenever possible.
Benefits:
- Additional security
- Protection against stolen devices
- Stronger authentication
A passphrase is highly recommended for both personal and production systems.
---
Step 5: Copy Your Public Key to a Server
Linux and macOS:
ssh-copy-id username@server_ip
Example:
ssh-copy-id [email protected]
Or manually copy:
cat ~/.ssh/id_ed25519.pub
Paste into:
~/.ssh/authorized_keys
Set proper permissions:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
---
Step 6: Test SSH Key Authentication
Reconnect:
ssh username@server_ip
You should no longer need the server password.
SSH now uses your key pair for authentication.
---
Step 7: Use the SSH Agent
The SSH agent remembers your key.
Linux and macOS:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Windows PowerShell:
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519
---
SSH for Git and GitHub
One of the most common uses of SSH is authenticating with Git hosting platforms.
SSH allows secure:
- Clone
- Pull
- Push
- Fetch
- Deployment operations
without repeatedly entering credentials.
---
HTTPS vs SSH
HTTPS:
git clone https://github.com/username/project.git
SSH:
git clone [email protected]:username/project.git
SSH is preferred by most developers because it is more convenient and secure.
---
Add Your SSH Key to GitHub
Display your public key:
Linux and macOS:
cat ~/.ssh/id_ed25519.pub
Windows:
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
Copy the output.
In GitHub:
1. Settings
2. SSH and GPG Keys
3. New SSH Key
4. Paste your key
5. Save
GitHub Documentation:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh
---
Test GitHub Authentication
ssh -T [email protected]
Expected output:
Hi username! You've successfully authenticated.
---
Clone Repositories with SSH
git clone [email protected]:username/project.git
Common commands:
git pull
git push
git fetch
No passwords are required after setup.
---
Multiple Git Accounts
Create separate keys:
id_ed25519_personal
id_ed25519_work
Configure:
~/.ssh/config
Example:
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
This separates personal and professional accounts.
---
Transfer Files with SCP
Upload:
scp file.txt user@server:/home/user/
Download:
scp user@server:/home/user/file.txt .
Custom port:
scp -P 2222 file.txt user@server:/home/user/
---
Transfer Files with SFTP
Connect:
sftp username@server
Upload:
put file.txt
Download:
get file.txt
Exit:
exit
---
Secure Your SSH Server
Open:
sudo nano /etc/ssh/sshd_config
Disable root login:
PermitRootLogin no
Disable passwords:
PasswordAuthentication no
Optional custom port:
Port 2222
Allow specific users:
AllowUsers ubuntu admin
Restart SSH:
Ubuntu and Debian:
sudo systemctl restart ssh
Fedora and RHEL:
sudo systemctl restart sshd
---
Useful SSH Features
Local Port Forwarding
ssh -L 8080:localhost:80 user@server
Useful for:
- Databases
- Internal web applications
- Development environments
---
Remote Port Forwarding
ssh -R 8080:localhost:3000 user@server
---
Dynamic Port Forwarding
ssh -D 1080 user@server
Creates a SOCKS proxy.
---
Persistent Sessions with tmux
Install:
sudo apt install tmux
Start:
tmux
Applications continue running even if your SSH session disconnects.
---
SSH Best Practices
✅ Use SSH keys instead of passwords
✅ Use Ed25519 keys
✅ Protect keys with passphrases
✅ Disable root login
✅ Disable password authentication
✅ Keep OpenSSH updated
✅ Use a firewall
✅ Verify server fingerprints
✅ Use SSH agent
✅ Back up SSH keys securely
✅ Remove unused keys
✅ Use separate keys for work and personal accounts
✅ Use tmux for long-running tasks
---
What's Next?
Now that you've mastered SSH fundamentals, you're ready to:
- Manage Linux servers
- Deploy applications
- Work with Docker
- Administer cloud infrastructure
- Use Git and GitHub professionally
- Configure CI/CD pipelines
- Access Raspberry Pi devices
- Build home labs
- Learn advanced SSH tunneling
- Automate infrastructure with Ansible
- Manage Kubernetes clusters
SSH is one of the foundational skills in Linux, cloud computing, DevOps, cybersecurity, and software engineering. Nearly every modern infrastructure platform depends on it, making it an essential tool for every developer and IT professional.
Master SSH, and you'll unlock secure access to servers, cloud platforms, Git repositories, and infrastructure anywhere in the world.