Step 1. ssh-keygen으로 로컬호스트에 키 생성
yklee@tyolee:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/yklee/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/yklee/.ssh/id_rsa.
Your public key has been saved in /home/yklee/.ssh/id_rsa.pub.
The key fingerprint is:
f2:b2:ca:5f:12:a1:77:c3:be:5f:04:5c:a2:9c:24:54 yklee@tyolee
The key's randomart image is:
+--[ RSA 2048]----+
| .o.E . . |
| + + o |
| . + o |
| . o . |
| . + S . |
| . * . . |
| o + . |
| . = . . |
| ooo ... |
+-----------------+
Step 2: ssh-copy-id로 public key 를 리모트 호스트로 카피
yklee@tyolee:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub moderato.snu.ac.kr
yklee@moderato.snu.ac.kr's password:
Now try logging into the machine, with "ssh 'moderato.snu.ac.kr'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
yklee@tyolee:~$
* ssh-copy-id 는 리모트 호스트의 .ssh/authorized_keys 에 키를 추가하게 된다.
Step 3. 리모트 호스트에 접속하면 패스워드를 묻지 않는다.
yklee@tyolee:~$ ssh moderato.snu.ac.kr
Linux moderato 2.6.24-24-server #1 SMP Sat Aug 22 01:40:42 UTC 2009 i686
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
Last login: Thu Mar 4 10:50:24 2010 from 112.216.249.82
[yklee@moderato ~] ll .ssh/
authorized_keys known_hosts
[yklee@moderato ~] ll .ssh/authorized_keys
-rw------- 1 yklee 394 2010-03-04 11:02 .ssh/authorized_keys
'개발 > Server Side' 카테고리의 다른 글
Safe Reboot - Magic SysRq Key (0) | 2010.03.04 |
---|---|
주기적으로 작업 실행 - cron (0) | 2010.03.04 |
swap 영역 설정하기 (0) | 2010.03.04 |
파일시스템 정보 확인 및 변경 - tune2fs (0) | 2010.03.04 |
history 명령어 응용 (0) | 2010.02.11 |