linux
윈도우터미널에서 ssh 암호없이 원격 접속
gusalstm
2021. 7. 15. 09:34
반응형
윈도우에서 키젠하고 ssh-copy-id 명령어가 없으므로
아래내용대로 명령어 입력
1) 키젠
PS C:\Users\user\.ssh> ssh-keygen
Generating public/private rsa key pair.
2) 공개키 이동복사
PS C:\Users\user\.ssh> type C:\Users\user\.ssh\id_rsa.pub | ssh root@192.168.56.10 "cat >> /root/.ssh/authorized_keys"
root@192.168.56.10's password:
PS C:\Users\user\.ssh> ssh root@192.168.56.10
Last login: Wed Jul 14 20:21:13 2021 from 192.168.56.1
3) 비밀번호를 계속 물어보면 chmod 600 으로 권한 변경해준다. (필요한 경우 restorecon 도 확인)
[user@ansible-server ~]$ chmod 600 .ssh/authorized_keys
[user@ansible-server ~]$ restorecon -R -v /home/user/.ssh/
[user@ansible-server ~]$ ls -lZ .ssh/
-rw-------. user user unconfined_u:object_r:ssh_home_t:s0 authorized_keys
-rw-r--r--. user user unconfined_u:object_r:ssh_home_t:s0 known_hosts
728x90