Enable SSH connection to Ubuntu server

2024-03-01
2023-07-10

I note how to install a package to enable SSH connection on Ubuntu 22.04 and how to connect.

Install a package

terminal

$ sudo apt update
$ sudo apt install openssh-server

To check the status of SSH, you should use the following command.

terminal

$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: e>
     Active: active (running) since Mon 2023-07-10 21:43:14 JST; 35min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 5636 (sshd)
      Tasks: 1 (limit: 18969)
     Memory: 4.1M
        CPU: 169ms
     CGroup: /system.slice/ssh.service
             └─5636 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Show the IP address in Settings > Wi-Fi > SSID.

Connection settings

You can easily connect to the destination PC with the below settings.

~/.ssh/config

Host <hostname>
  Hostname <IP Address>
  User <username>

terminal

$ ssh <hostname>