1. 기존 설치확인
root@ubuntudaonelab:/etc/ssh# dpkg -l | grep openssh
ii openssh-client 1:8.3p1-1ubuntu0.1 amd64 secure shell (SSH) client, for secure access to remote machines
2. 기존 서비스 확인
root@ubuntudaonelab:/etc/ssh# service --status-all | grep +
[ + ] acpid
[ + ] apparmor
[ + ] apport
[ + ] avahi-daemon
[ + ] cron
[ + ] cups
[ + ] cups-browsed
[ + ] dbus
[ + ] gdm3
[ + ] grub-common
[ + ] irqbalance
[ + ] kerneloops
[ + ] kmod
[ + ] openvpn
[ + ] plymouth-log
[ + ] procps
[ + ] rsyslog
[ + ] udev
[ + ] ufw
[ + ] unattended-upgrades
[ + ] vmware-tools
[ + ] whoopsie
[ + ] xrdp
3. 페키지목록 업데이트
root@ubuntudaonelab:/etc/ssh# apt-get update
Hit:1 http://kr.archive.ubuntu.com/ubuntu groovy InRelease
Get:2 http://security.ubuntu.com/ubuntu groovy-security InRelease [110 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu groovy-updates InRelease [115 kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu groovy-backports InRelease [101 kB]
Get:5 http://security.ubuntu.com/ubuntu groovy-security/main amd64 DEP-11 Metadata [4,676 B]
Get:6 http://security.ubuntu.com/ubuntu groovy-security/universe amd64 DEP-11 Metadata [4,540 B]
Get:7 http://kr.archive.ubuntu.com/ubuntu groovy-updates/main amd64 DEP-11 Metadata [40.6 kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu groovy-updates/universe amd64 DEP-11 Metadata [104 kB]
Get:9 http://kr.archive.ubuntu.com/ubuntu groovy-updates/universe DEP-11 48x48 Icons [107 kB]
Get:10 http://kr.archive.ubuntu.com/ubuntu groovy-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:11 http://kr.archive.ubuntu.com/ubuntu groovy-backports/universe amd64 DEP-11 Metadata [600 B]
Fetched 589 kB in 3s (169 kB/s)
Reading package lists... Done
4. openssh-server 설치
root@ubuntudaonelab:/etc/ssh# apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ncurses-term openssh-sftp-server ssh-import-id
Suggested packages:
molly-guard monkeysphere ssh-askpass
The following NEW packages will be installed:
ncurses-term openssh-server openssh-sftp-server ssh-import-id
0 upgraded, 4 newly installed, 0 to remove and 65 not upgraded.
Need to get 691 kB of archives.
After this operation, 5,983 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
5. 페키지 설치 확인
root@ubuntudaonelab:/etc/ssh# dpkg -l | grep openssh
ii openssh-client 1:8.3p1-1ubuntu0.1 amd64 secure shell (SSH) client, for secure access to remote machines
ii openssh-server 1:8.3p1-1ubuntu0.1 amd64 secure shell (SSH) server, for secure access from remote machines
ii openssh-sftp-server 1:8.3p1-1ubuntu0.1 amd64 secure shell (SSH) sftp server module, for SFTP access from remote machines
6. 서비스 가동 확인
root@ubuntudaonelab:/etc/ssh# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-04-24 14:45:24 KST; 3min 5s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 203952 (sshd)
Tasks: 1 (limit: 4614)
Memory: 1.4M
CGroup: /system.slice/ssh.service
└─203952 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
4월 24 14:45:23 ubuntudaonelab.com systemd[1]: Starting OpenBSD Secure Shell server...
4월 24 14:45:24 ubuntudaonelab.com sshd[203952]: Server listening on 0.0.0.0 port 22.
4월 24 14:45:24 ubuntudaonelab.com sshd[203952]: Server listening on :: port 22.
4월 24 14:45:24 ubuntudaonelab.com systemd[1]: Started OpenBSD Secure Shell server.
root@ubuntudaonelab:/etc/ssh#
root@ubuntudaonelab:/etc/ssh#
root@ubuntudaonelab:/etc/ssh#
root@ubuntudaonelab:/etc/ssh#
root@ubuntudaonelab:/etc/ssh# service --status-all | grep +
[ + ] acpid
[ + ] apparmor
[ + ] apport
[ + ] avahi-daemon
[ + ] cron
[ + ] cups
[ + ] cups-browsed
[ + ] dbus
[ + ] gdm3
[ + ] grub-common
[ + ] irqbalance
[ + ] kerneloops
[ + ] kmod
[ + ] openvpn
[ + ] plymouth-log
[ + ] procps
[ + ] rsyslog
[ + ] ssh
[ + ] udev
[ + ] ufw
[ + ] unattended-upgrades
[ + ] vmware-tools
[ + ] whoopsie
[ + ] xrdp
root@ubuntudaonelab:/etc/ssh# netstat -anop | grep ssh
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 203952/sshd: /usr/s off (0.00/0/0)
tcp6 0 0 :::22 :::* LISTEN 203952/sshd: /usr/s off (0.00/0/0)
unix 2 [ ACC ] STREAM LISTENING 41160 897/systemd /run/user/126/gnupg/S.gpg-agent.ssh
unix 2 [ ACC ] STREAM LISTENING 49803 1737/systemd /run/user/0/gnupg/S.gpg-agent.ssh
unix 2 [ ACC ] STREAM LISTENING 51581 1980/gnome-keyring- /run/user/0/keyring/ssh
unix 2 [ ACC ] STREAM LISTENING 49109 1822/ssh-agent /tmp/ssh-SHnhBWOHrEKB/agent.1744
unix 3 [ ] STREAM CONNECTED 4997964 203952/sshd: /usr/s
설치만 해도 가동되어 있음.
7. root접속허용후 재시작
root@ubuntudaonelab:/etc/ssh# vi sshd_config
-----------------------------------------------------------------------------
PermitRootLogin yes
-----------------------------------------------------------------------------
root@ubuntudaonelab:/etc/ssh# systemctl restart ssh