This article is part of a series.
- SSH Series
- Part 1: Introduction to SSH
- Part 2: Setting Up and Using SSH
- Part 3: SSH Key Based Authentication
- Part 4: SSH Best Practices and Security Hardening
- Part 5: Advanced SSH Techniques
- Part 6: Troubleshooting Common SSH Issues
- Part 7: Automating Tasks With Automation
- Part 8: SSH Alternatives and Enhancements
- Part 9: Recap, Further Resources, and Closing Thoughts
Welcome back to our SSH series! In the previous instalment, I discussed the origins of SSH and why it replaced Telnet. Now, let’s roll up our sleeves and get hands-on. In this post, I’ll walk through installing SSH on various systems and outline basic commands you’ll use to connect and manage remote machines
Installing SSH
SSH on Linux
Most Linux distributions come with OpenSSH (both client and server) readily available in their default repositories.
Ubuntu/Debian
-
Install the ssh client (if not already installed):
sudo apt-get update sudo apt-get install openssh-client
-
Install the server (to accept incoming connections):
sudo apt-get update sudo apt-get install openssh-server
-
Check if SSH is running:
sudo systemctl status ssh
If it’s not active, start it:
sudo systemctl enable ssh sudo systemctl start ssh
CentOS/RHEL
-
Install OpenSSH:
sudo yum install openssh openssh-server
-
Enable and start the service:
sudo systemctl enable sshd sudo systemctl start sshd
-
Check status:
sudo systemctl status sshd
Once installed and running, your Linux server will listen on the default port 22 for SSH connections.
SSH on macOS
SSH Client is already installed on macOS by default. Just open Terminal and type:
ssh user@hostname
SSH on Windows
Modern Windows (Windows 10 and 11) can use the OpenSSH client that’s built in, or you can install PuTTY as an alternative.
Using the Built-In OpenSSH Client
Check if OpenSSH is installed
-
Open PowerShell or Command Prompt and type:
ssh
-
If you see usage information, you have it installed. Otherwise, enable it:
- Go to
Settings
->Apps
->Optional features
->add a feature
->OpenSSH Client
- Go to
Connecting
ssh user@remote-host
Using PuTTy

- Download PuTTy and Install it
- Launch:
- Enter the
hostname
orIP
of the remote server - Port:
22
- Connection type:
SSH
- Click
Open
- Enter the
- Login:
- If it’s your first time connecting, you’’ll see a security alert about the host key. Accept it if it matches your server’s key fingerprint
Basic SSH Commands
SSH is powerful but starts with a few core commands and options.
Connecting to a Server
The simplest command form:
bash ssh user@remote-host
Where
user
: The username on the remote system
remote-host
: This can be an IP address or a domain name (e.g.. 192.168.1.132
or example.com
)
If your username on the local machine matches the remote username, you can sometimes omit user@
Common Command-Line Flags
-
-p <port>
: Connect to a non-standard portssh -p 2222 user@remote-host
-
-i <keyfile>
: Specify a private key file for authenticationssh -i ~/.ssh/mykey user@remote-host
-
-v
: Increase verbosity (helpful for troubleshooting). You can stack like-vvv
for more detailsssh -v user@remote-host
-
-L <local-port>:<host>:<remote-port>
: Local port forwarding (Its a advanced topic. Let me know if you need more information on this topic) -
-N
: Don’t execute a remote command; just forward ports (useful for tunnelling scenarios)
Key SSH Files and Directories
-
~/.ssh/
Folder This is your personal SSH directory within your home folder- Linux/MacOS:
/home/<username>/.ssh/
or/Users/<username>/.ssh/
- Windows (with OpenSSH):
C:\Users\<username>\.ssh\
It stores: Private/Public keys
(e.g.,id_rsa
,id_rsa.pub
)Known_hosts
(servers you’ve connected to)Config
file (for custom SSH settings)
- Linux/MacOS:
-
Authorized Keys File
- Location:
~/.ssh/authorized_keys
on the remote server - Purpose: Stores public keys of clients allowed to connect
- If you set up
key-based authentication
on your server, you append yourpublic key
(.pub
file) to this file
- Location:
-
Known Hosts file
- Location:
~/.ssh/known_hosts
on the client machine. - Purpose: Maintains
host fingerprints
for servers you’ve connected to, preventing man-in-the-middle attacks - When you connect to a server for the first time, SSH prompts you to accept its fingerprint, which is then stored here
- Location:
Wrapping Up
By installing SSH and mastering these basic commands, you can securely connect to remote Linux, macOS, or Windows systems. SSH is a cornerstone of server administration and development workflows, enabling you to manage files, processes, and configurations from anywhere.
In the next part of SSH
series, I’ll dive deeper into key-based authentication—a more secure and convenient method than using passwords. I’ll show you how to generate SSH keys, manage them, and disable password logins entirely.
If you have questions or want to share your experience with SSH, drop a comment below! I’d love to hear your thoughts as I continue exploring how machines secretly chat across the internet.
This article is part of a series.
- SSH Series
- Part 1: Introduction to SSH
- Part 2: Setting Up and Using SSH
- Part 3: SSH Key Based Authentication
- Part 4: SSH Best Practices and Security Hardening
- Part 5: Advanced SSH Techniques
- Part 6: Troubleshooting Common SSH Issues
- Part 7: Automating Tasks With Automation
- Part 8: SSH Alternatives and Enhancements
- Part 9: Recap, Further Resources, and Closing Thoughts
comments powered by Disqus