madebychung

SSH 키 가져오기 /ubuntu 본문

system

SSH 키 가져오기 /ubuntu

mdchung 2022. 7. 25. 10:57

secureCRT SSH 로그인하기

1. 우분투에 ssh 설치 

root@admin1-virtual-machine:/#  apt update

root@admin1-virtual-machine:/#  apt install openssh-server
root@admin1-virtual-machine:/#  apt list openssh*
root@admin1-virtual-machine:/# systemctl status sshd
root@admin1-virtual-machine:/# sudo ufw allow ssh

SSH 로 로그인 설정

개인키가 있는곳에서 복사하려고 했는데 

[root@centos7 ~]# cd .ssh
[root@centos7 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
[root@centos7 .ssh]# ssh-copy-id -i id_rsa.pub 192.168.80.143  <- 가져갈 pc의 ip

 

root@192.168.80.143's password: 
Permission denied, please try again. <- 퍼미션 디나이가 뜨고 

 

 

The server has disconnected with an error.  Server message reads:
A protocol error occurred. Change of username or service not allowed: (root,ssh-connection) -> (admin1,ssh-connection)

 

이렇게 오류가 떴다

권한 문제 

우분투에 들어가서 

root@admin1-virtual-machine:/# vi /etc/ssh/sshd_config 

주석 제거 및 PermissionRootLogin yes 로 변경해준다 


root@admin1-virtual-machine:/# systemctl restart sshd

 

 

키가 잘 복사 되었고 

secureCRT 에서 잘 로그인이 된다