본문 바로가기
OS-OE Knowledge/Linux-Unix KB

ssh connects to remote host - passwordless

by 스쳐가는인연 2017. 4. 9.

계정 질의 없이 원격 호스트 접속하기

Environment:
My Host       : 10.10.10.11
Remote Host : 10.10.10.12


1. 인증키 생성 (My Host)
e.g.)
# ssh-keygen -t rsa

2. 연결
# ssh <%UserName%>@<%RemoteHost%>

e.g.)
# ssh root@10.10.10.12
# exit (접속해제)

3. 키 업로드
# cat .ssh/id_rsa.pub | ssh <%UserName%>@<%RemoteHost%> 'cat >> .ssh/authorized_keys'

e.g.)
# cat .ssh/id_rsa.pub | ssh root@10.10.10.12 'cat >> .ssh/authorized_keys'

4. 권한 설정
# ssh root@10.10.10.12 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"


출처 :
SSH Passwordless Login Using SSH Keygen in 5 Easy Steps
http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/

반응형