레이블이 without password인 게시물을 표시합니다. 모든 게시물 표시
레이블이 without password인 게시물을 표시합니다. 모든 게시물 표시

2014년 2월 13일 목요일

Rsync 비밀번호 없이 실행하기 (Exec Rsync without Password)


Crontab Rsync without Password

1. local 서버에서 ssh-keygen 을 실행하여 "id_rsa.pub" 파일을 작성한다.
(by running "ssh-copy-id", sent the file - "id_rsa.pub" to the Remote Server.)

2. 작성된 "id_rsa.pub" 파일을 "ssh-copy-id" 를 실행하여 Remote Server 로 전송한다.
( by running ssh-keygen, make the file "id_rsa.pub" to be written on local server)

3. Rsync를 실행하여 패스워드 없이 접속되는 것을 확인한다.
(confirm to execute Rsync ...)

- 로컬 서버와 Remote 서버에 ssh-keygen 으로 만든 같은 비밀번호가 저장되어 있으므로, IP가 변경이 되어도 패스워드 없이 계속 접속할 수 있다.


예제(example)

> ssh-keygen
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
c9:b8:27:a2:bd:xx:xx:xx:xx:34:a5:ef:89:f1:ec:ec root@www6.gettyimageskorea.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| xxxxx |
| xxxxxx |
| . o . |
| xxxxxx |
| xxxxxxxx . |
| . +xxxxx+. |
+-----------------+

> ssh-copy-id -i ~/.ssh/id_rsa.pub xxx.xxx.xxx.xxx
root@xxx.xxx.xxx.xxx's password:

Now try logging into the machine, with "ssh '121.78.196.150'", and check in:

.ssh/authorized_keys

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

done.
---------------------------------------------------------------------------