Remote administration on Ubuntu needs a reachable SSH server. OpenSSH from Ubuntu's repositories provides encrypted logins, with a listener check, firewall access, and a login from another computer confirming the installation.

Fresh Ubuntu 24.04 LTS and 26.04 LTS installations use socket activation for OpenSSH. systemd listens for connections and starts the SSH service on demand, so an inactive service before the first connection does not by itself mean SSH is unavailable. Whether Ubuntu Server already has the server installed depends on the installer or image choices.

Use an existing sudo-capable Ubuntu account, a trusted network, and another computer with an SSH client. Installing the server makes remote authentication available on its listening interfaces, so public exposure should wait until key authentication and network restrictions are in place. Keep console access or an existing session open until the new login succeeds.

Steps to install the OpenSSH server on Ubuntu:

  1. Refresh the Ubuntu package index.
    $ sudo apt update
  2. Install the OpenSSH server package from Ubuntu's repositories.
    $ sudo apt install --assume-yes openssh-server
  3. Check that SSH is listening on TCP port 22.
    $ systemctl status ssh.socket
    ● ssh.socket - OpenBSD Secure Shell server socket
         Loaded: loaded (/usr/lib/systemd/system/ssh.socket; enabled; preset: enabled)
         Active: active (listening) since Fri 2026-11-06 16:39:51 UTC; 2s ago
     Invocation: f074e5f21e0c48a0824d38e006acf464
       Triggers: ● ssh.service
         Listen: 0.0.0.0:22 (Stream)
                 [::]:22 (Stream)
    ##### snipped #####

    active (listening) means systemd is waiting on the port and starts ssh.service at the first connection. If it shows inactive on Ubuntu 24.04 LTS or later, sudo systemctl enable --now ssh.socket starts the socket and keeps it enabled for later boots. Ubuntu 22.04 LTS runs the service continuously, so use systemctl status ssh there, expect active (running), and skip the socket command because it would stop that service.

  4. Identify the Ubuntu server address reachable from the other computer.
    $ hostname -I
    192.0.2.10

    192.0.2.10 represents the server address in the later commands. On a machine with several addresses, use the one on the same network as the other computer.

  5. Check whether the UFW firewall is active.
    $ sudo ufw status
    Status: active

    If it shows Status: inactive, or UFW is not installed, skip the next step. Router and cloud firewall rules can still block TCP port 22, though a connection within a home network normally needs no router change.

  6. Allow SSH through UFW if it is active.

    This rule accepts SSH connections from every address that can reach the computer, so an Internet-facing server should have key authentication in place first.

    $ sudo ufw allow ssh
    Rule added
    Rule added (v6)
  7. Log in from the other computer with your Ubuntu account, typing yes at the first-connection key prompt.
    $ ssh user@192.0.2.10
    The authenticity of host '192.0.2.10 (192.0.2.10)' can't be established.
    ED25519 key fingerprint is: SHA256:ThZirOLB1BkKaCADXUduthoMfjmDkarpm+t77ouzFDU
    This key is not known by any other names.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '192.0.2.10' (ED25519) to the list of known hosts.
    user@192.0.2.10's password:
    ##### snipped #####
    user@ubuntu-ssh:~$ 

    user represents your Ubuntu account, and the password is that account's password, which is not displayed while typing. The other computer needs an SSH client; on Ubuntu, its package is openssh-client. The remote prompt confirms the OpenSSH server is working.

    On a network you do not fully trust, compare the prompt's fingerprint with ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub run at the server's console before typing yes. A mismatch means the server identity is unconfirmed, so do not accept the key.

    Connection timed out points to the address or a firewall on the path. Connection refused means nothing accepted TCP port 22, so check the address and the listening step. Permission denied means the server was reached but rejected the account or its password.

Share this guide