在复制/移动文件从一台机器到另一台机器时会用到scp,因为它比较安全。但如果每次都要输入密码,就比较烦,尤其是在script里。不过,ssh有另一种用密钥对来验证的方式。下面写出我生成密匙对的过程,供大家参考。
第一步:生成密匙对,我用的是rsa的密钥。使用命令 "ssh-keygen -t rsa"
[user1@rh user1]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory '/home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your publi...[ 查看全文 ]