Installing SSH
SSH is supported on a wide range of operating systems, making it a versatile tool for remote system access and management. This section covers the installation process for SSH across major platforms.
Linux
On most Linux distributions, OpenSSH is available by default. If SSH is not already installed, it can be easily added through the package manager.
For Debian-based systems (e.g., Ubuntu):
$ sudo apt update
$ sudo apt install openssh-server
For Red Hat-based systems (e.g., Fedora, CentOS):
$ sudo dnf install openssh-server
Once installed, SSH can be enabled and started:
$ sudo systemctl enable ssh
$ sudo systemctl start ssh
FreeBSD
FreeBSD includes OpenSSH in the base system, so installation is typically unnecessary. However, SSH can be enabled at boot time by editing the /etc/rc.conf file:
sshd_enable="YES"
Start the SSH service manually if it’s not already running:
# service sshd start
OpenBSD
OpenBSD is the home of OpenSSH, so SSH is pre-installed and enabled by default. No additional configuration is required for basic use, though adjustments to the configuration files can be made as needed.
macOS
SSH is pre-installed on macOS. To enable the SSH server (so other machines can connect to it), use System Preferences:
- Open System Preferences.
- Go to Sharing.
- Check the box for Remote Login.
This will enable SSH access, allowing remote connections to the machine.
Windows
Windows 10 and later versions include an optional OpenSSH client and server. To install the OpenSSH client or server, use Windows Settings:
- Open Settings.
- Navigate to Apps > Optional Features.
- Scroll down and install OpenSSH Client and/or OpenSSH Server.
Alternatively, SSH can be installed using PowerShell:
# Install the OpenSSH client
Add-WindowsCapability -Online -Name OpenSSH.Client*
# Install the OpenSSH server
Add-WindowsCapability -Online -Name OpenSSH.Server*
Start and enable the SSH server with:
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
After installation, SSH can be configured to suit different use cases, which will be covered in the next section.