PuTTY

김상훈·2024년 4월 3일
0

Linux

목록 보기
11/14
post-custom-banner

ubuntu 세팅

# cmd or powershell 관리자 권한으로 실행 후 우분투 시작
C:\Windows\system32>wsl --install

# 패키지 관리자 업데이트
kosa1004@DESKTOP-4U4G4G2:~$ sudo apt update

# ssh 접속할 수 있는 서비스 다운
kosa1004@DESKTOP-4U4G4G2:~$ sudo apt install openssh-server

# ssh 서비스 실행
kosa1004@DESKTOP-4U4G4G2:~$ sudo systemctl enable ssh

# ssh 서비스 실행됐는지 확인
kosa1004@DESKTOP-4U4G4G2:~$ sudo systemctl status ssh

● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2024-04-03 17:11:52 KST; 40s ago
             ------ 이렇게 나와야함
               
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 1252 (sshd)
      Tasks: 1 (limit: 9354)
     Memory: 1.7M
     CGroup: /system.slice/ssh.service
             └─1252 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Apr 03 17:11:52 DESKTOP-4U4G4G2 systemd[1]: Starting OpenBSD Secure Shell server...
Apr 03 17:11:52 DESKTOP-4U4G4G2 sshd[1252]: Server listening on 0.0.0.0 port 22.
Apr 03 17:11:52 DESKTOP-4U4G4G2 sshd[1252]: Server listening on :: port 22.
Apr 03 17:11:52 DESKTOP-4U4G4G2 systemd[1]: Started OpenBSD Secure Shell server.

# 해당 ubuntu 가상머신의 ip를 확인할 수 있는 서비스 다운
kosa1004@DESKTOP-4U4G4G2:~$ sudo apt install net-tools

# ip 확인
kosa1004@DESKTOP-4U4G4G2:~$ sudo ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.21.85.3  netmask 255.255.240.0  broadcast 172.21.95.255
        ---------------- 이게 IP임
        
        inet6 fe80::215:5dff:fe84:d2e3  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:84:d2:e3  txqueuelen 1000  (Ethernet)
        RX packets 5057  bytes 33107460 (33.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3960  bytes 289383 (289.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        
# 호스트키 생성
kosa1004@DESKTOP-4U4G4G2:~$ sudo ssh-keygen -A
#>> ssh-keygen: generating new host keys: DSA

# 비밀번호 인증방식 사용하기 위한 nano 편집
kosa1004@DESKTOP-4U4G4G2:~$ sudo nano /etc/ssh/sshd_config

다음 순서대로 진행

  1. ctrl + w 로 문자열 검색
  2. PasswordAuthentication 찾고
  3. 옵션이 no로 되어있으면 yes로 변경

  1. 다 됐으면 ctrl + x 로 나가기
  2. yes 로 저장

IP 확인

## ssh 서비스 시작
kosa1004@DESKTOP-4U4G4G2:~$ sudo service ssh start

## ssh 서비스 active 중이면 완료
kosa1004@DESKTOP-4U4G4G2:~$ sudo systemctl status ssh

## IP 확인
kosa1004@DESKTOP-4U4G4G2:~$ sudo ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.21.85.3  netmask 255.255.240.0  broadcast 172.21.95.255
             -----------
             
        inet6 fe80::215:5dff:fe84:d2e3  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:84:d2:e3  txqueuelen 1000  (Ethernet)
        RX packets 5408  bytes 33372838 (33.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4102  bytes 341224 (341.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

PuTTY 설치

Download PuTTY: latest release (0.80)

ID: kosa1004

PW: ****

출처

WSL2[4] - SSH 접속하기

리눅스 nano 편집기 단축키

post-custom-banner

0개의 댓글