openssh-client vs openssh-server on Ubuntu
Secure Shell (SSH) is the standard protocol for securing remote
connections and administrative tasks on Linux systems. In Ubuntu, SSH
capabilities are divided into two distinct software packages:
openssh-client and openssh-server. This
article explains the fundamental differences between these two packages,
their key components, and how to determine which one you need to install
on your system.
The Core Difference
The primary difference lies in the direction of the connection.
- openssh-client is used to initiate connections outbound from your local machine to a remote computer.
- openssh-server is used to accept inbound connection requests from remote machines, allowing them to control your local system.
What is openssh-client?
The openssh-client package contains the tools required
to connect to other systems. If you want to log into a remote server,
transfer files securely to another machine, or run commands on a remote
VPS, you only need the client package.
Key Tools Included:
ssh: The main command-line tool used to log into a remote machine (e.g.,ssh user@remote-host).scp: Secure Copy, used to copy files between hosts over an encrypted SSH connection.sftp: Secure File Transfer Protocol, an interactive file transfer program similar to FTP but fully encrypted.ssh-keygen: A utility to generate, manage, and convert authentication keys for passwordless logins.
Installation Status on Ubuntu:
The openssh-client package is installed by default on
almost all Ubuntu installations, including Ubuntu Desktop and Ubuntu
Server.
What is openssh-server?
The openssh-server package allows your Ubuntu machine to
act as an SSH host. Once installed and configured, it listens for
incoming connection requests. If you want to access your Ubuntu machine
from another computer, you must install this package.
Key Components Included:
sshd: The SSH daemon. This is a background service that continuously listens for incoming connections (by default on TCP port 22).- Configuration files: Located in
/etc/ssh/sshd_config, which allow you to configure port numbers, disable password logins, and set up firewall rules.
Installation Status on Ubuntu:
- Ubuntu Server: Usually installed by default during the operating system installation.
- Ubuntu Desktop: Not installed by default for security reasons. If you want to access your desktop remotely, you must install it manually.
Comparison Summary
| Feature | openssh-client | openssh-server |
|---|---|---|
| Primary Purpose | Connect to remote systems | Allow remote systems to connect to you |
| Background Service | None (runs on demand) | Runs continuously in the background
(sshd) |
| Default Port | Not applicable | Port 22 (configurable) |
| Ubuntu Desktop Default | Pre-installed | Not installed |
| Typical Use Case | Developers, system administrators, daily desktop users | Web servers, cloud instances, remote home servers |
How to Install and Manage the Packages
You can manage both packages using Ubuntu’s default package manager,
apt.
Installing openssh-client
If for some reason the client is missing from your system, install it with:
sudo apt update
sudo apt install openssh-clientInstalling openssh-server
To allow other machines to connect to your Ubuntu system, install the server package:
sudo apt update
sudo apt install openssh-serverManaging the SSH Server Service
Unlike the client, the server runs as a system service. You can control its status using the following commands:
Check if the server is running:
sudo systemctl status sshStart the SSH server:
sudo systemctl start sshEnable the SSH server to start automatically on boot:
sudo systemctl enable ssh