ssh 로그인 없이 접속하기

 

SSH_public_private_key

ssh 로그인 없이 접속하기

계정에 .ssh 디렉토리에 ssh키가 존재하는지 확인.

$ ls -al ~/.ssh
total 12
-rw-r--r-- 1 user user  222 2012-04-18 10:16 known_hosts

없으면 ssh-keygen을 사용해 rsa 알고리즘에 기반한 키를 생성

$ ssh-keygen -t rsa
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
he key fingerprint is:
...
$ ls -al ~/.ssh
-rw------- 1 user user 1679 2012-04-18 10:19 id_rsa
-rw-r--r-- 1 user user  396 2012-04-18 10:19 id_rsa.pub
-rw-r--r-- 1 user user  222 2012-04-18 10:16 known_hosts

생성한 키중의 공개키를 복사(id_rsa는 개인키므로 복사하지 말 것.)

$ ssh-copy-id -i .ssh/id_rsa.pub xxx.xxx.xxx.xxx
The authenticity of host 'xxx.xxx.xxx.xxx' can't be established.
Are you sure you want to continue connecting (yes/no)? yes
user@xxx.xxx.xxx.xxx's password:
Now try logging into the machine, with "ssh 'xxx.xxx.xxx.xxx'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

ssh 접속을 통해 인증없이 통과 되는지 확인.

]$ ssh user@xxx.xxx.xxx.xxx

 

This entry was posted in Network, System, Util/Tools and tagged , , , . Bookmark the permalink.

댓글 남기기