1.製作public keys & private keys
[root@local ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. 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: 7e:16:f4:57:87:5c:60:be:91:70:82:ac:cc:a9:95:74 root@localhost.localdomain
2. 從local機器複製/root/.ssh/id_dsa.pub到remote機器
[root@local ~]# scp /root/.ssh/id_dsa.pub root@remote:/root/.ssh/id_dsa.pub root@remote 's password: id_dsa.pub 100% |*****************************| 718 00:00
3.將id_dsa.pub加到authorized_keys
[root@remote ~]# cat /root/.ssh/id_dsa.pub >> /root/.ssh/authorized_keys
4.再以ssh連線到遠端機器, 未來將不用再輸入密碼啦
[root@local ~]# ssh root@remote
出處: 請問如何用scp或rsync每天自動備份到不同的日期目錄中?
沒有留言:
張貼留言