OpenSSHをインストールする!(Ubuntu Desktop 22.04)

Ubuntu Desktop 22.04に、OpenSSHをインストールします。

実行した環境を確認する!

実行した環境を確認します。

$ hostnamectl
 Static hostname: vmsubu06
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 516547b1d21f4fd2b0c3805ba6005f26
         Boot ID: c6cd6bda28fc49719a49bdf3587585cd
  Virtualization: oracle
Operating System: Ubuntu 22.04.2 LTS              
          Kernel: Linux 6.2.0-26-generic
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox

OpenSSH Serverをインストールする!

標準のリポジトリからOpenSSH Serverをインストールします。

$ sudo apt install openssh-server
[sudo] password for usradmin: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ncurses-term openssh-client openssh-sftp-server ssh-import-id
Suggested packages:
  keychain libpam-ssh monkeysphere ssh-askpass molly-guard
The following NEW packages will be installed:
  ncurses-term openssh-server openssh-sftp-server ssh-import-id
The following packages will be upgraded:
  openssh-client
1 upgraded, 4 newly installed, 0 to remove and 329 not upgraded.
Need to get 751 kB/1,661 kB of archives.
After this operation, 6,059 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssh-sftp-server amd64 1:8.9p1-3ubuntu0.3 [38.8 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssh-server amd64 1:8.9p1-3ubuntu0.3 [434 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ncurses-term all 6.3-2ubuntu0.1 [267 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu jammy/main amd64 ssh-import-id all 5.11-0ubuntu1 [10.1 kB]
Fetched 751 kB in 2s (307 kB/s)     
Preconfiguring packages ...
(Reading database ... 199000 files and directories currently installed.)
Preparing to unpack .../openssh-client_1%3a8.9p1-3ubuntu0.3_amd64.deb ...
Unpacking openssh-client (1:8.9p1-3ubuntu0.3) over (1:8.9p1-3ubuntu0.1) ...
Selecting previously unselected package openssh-sftp-server.
Preparing to unpack .../openssh-sftp-server_1%3a8.9p1-3ubuntu0.3_amd64.deb ...
Unpacking openssh-sftp-server (1:8.9p1-3ubuntu0.3) ...
Selecting previously unselected package openssh-server.
Preparing to unpack .../openssh-server_1%3a8.9p1-3ubuntu0.3_amd64.deb ...
Unpacking openssh-server (1:8.9p1-3ubuntu0.3) ...
Selecting previously unselected package ncurses-term.
Preparing to unpack .../ncurses-term_6.3-2ubuntu0.1_all.deb ...
Unpacking ncurses-term (6.3-2ubuntu0.1) ...
Selecting previously unselected package ssh-import-id.
Preparing to unpack .../ssh-import-id_5.11-0ubuntu1_all.deb ...
Unpacking ssh-import-id (5.11-0ubuntu1) ...
Setting up openssh-client (1:8.9p1-3ubuntu0.3) ...
Setting up ssh-import-id (5.11-0ubuntu1) ...
Setting up ncurses-term (6.3-2ubuntu0.1) ...
Setting up openssh-sftp-server (1:8.9p1-3ubuntu0.3) ...
Setting up openssh-server (1:8.9p1-3ubuntu0.3) ...

Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
3072 SHA256:2k+U4CqwGFU/Pi8Dw/anb6SODzuETRmn06/iCcfQyAs root@vmsubu06 (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:AxjXIlW301xpjkNAAFZrwWOzXz5ZYU0UUzTai+QHyh8 root@vmsubu06 (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:n4hCC85Dqycjgx9rKHgzhtB7IEnPam+F7MnHegsQRSk root@vmsubu06 (ED25519)
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.servi
ce.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/s
ystemd/system/ssh.service.
rescue-ssh.target is a disabled or a static unit, not starting it.
ssh.socket is a disabled or a static unit, not starting it.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for ufw (0.36.1-4build1) ...

おわりに

Ubuntu Desktop 22.04では、標準のリポジトリからOpenSSHのサーバ機能をインストールすることができます。

関連記事