Ubuntu18.04 SSH(Secure Shell) 연결

by 민갤

Server /

확인

# cat /etc/ssh/sshd_config

설치

# sudo apt-get update
# sudo apt-get install -y openssh-server

패키지 설치 확인

# dpkg -l | grep openssh
ii  openssh-client                        1:7.6p1-4ubuntu0.3                amd64        secure shell (SSH) client, for secure access to remote machines
ii  openssh-server                        1:7.6p1-4ubuntu0.3                amd64        secure shell (SSH) server, for secure access from remote machines
ii  openssh-sftp-server                   1:7.6p1-4ubuntu0.3

실행 확인

# /bin/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 2019-05-11 06:44:55 UTC; 16min ago
  Process: 833 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 1011 (sshd)
    Tasks: 1 (limit: 1110)
   CGroup: /system.slice/ssh.service
           └─1011 /usr/sbin/sshd -D

May 11 06:44:54 localhost systemd[1]: Starting OpenBSD Secure Shell server...
May 11 06:44:55 localhost sshd[1011]: Server listening on 0.0.0.0 port 22.
May 11 06:44:55 localhost sshd[1011]: Server listening on :: port 22.
May 11 06:44:55 localhost systemd[1]: Started OpenBSD Secure Shell server.
May 11 07:00:58 localhost sshd[1446]: Accepted password for dico from 10.0.2.2 port 11643 ssh2
May 11 07:00:58 localhost sshd[1446]: pam_unix(sshd:session): session opened for user dico by (uid=0)

가상머신 설정 (Virtual Box)

설정> 네트워크 > 고급 > 포트 포워딩
이름프로토콜호스트IP호스트 포트게스트 IP게스트 포트
SSHTCP{PC IP: window:ipconfig}22{Virtual Box IP: Linux:hostname -I}22

- 2020.07.05 Ubuntu 20.04 : CMD ipconfig > 이더넷IP:호스트IP, 이더넷VirtualBox Network:게스트IP

Xshell

가상 머신을 켜둔 상태로 Shell 프로그램에서 접속한다.

  • Protocol: SSH
  • Host: {PC IP}
  • Port: 22
  • 계정 로그인

+ SSH 설정

# vi /etc/ssh/sshd_config
# /bin/systemctl restart ssh
  • PermitRootLogin {yes|no|without-password|prohibit-password} : root 계정 원격 접속 허용 여부
  • without-password : 비밀번호 로그인 접속 차단.
  • prohibit-password : 비밀번호 로그인 접속 차단. 인증키를 사용하여 접속
  • LoginGraceTime {제한시간} : 로그인 제한 시간. (60: 60초, 2M 2분, 0:제한없음)
  • MaxAuthTries {제한횟수} : 로그인 시도 가능한 횟수

Author

민갤

민갤

Back-End Developer

꾸잉꾸잉하고 웁니다.

로그인

디코에 오신 것을 환영해요!
전문가들의 수많은 아티클 창고 🤓