当前位置:Linux教程 - Linux综合 - 实现两机之间不用密码传输文件

实现两机之间不用密码传输文件

    首先假定有两台Linux机器,linux1和linux2。 你想从linux1向linux2拷贝机器时无需输入密码,或者是在ctontab中这样做。1. 安装SSH2. 创建两个用户,user1在linux1上,user2吱在linux2上。3. On linux2, login as user2. dossh-keygen -P "" -trsa1 -f ~/.ssh/identity4. Copy key file to linux1scp /home/user2/.ssh/identity.pub user1@linux1:/home/user1/.ssh/authorized_keys5. Change file permissionchmod 600 /home/user2/.ssh/authorized_keys6. change ssh config file: /etc/ssh/ssh_configAdHost *ForwardX11 yesIdentityFile ~/.ssh/identityProtocol 17. Restart sshd8. login to linux1 as user1.9.Change file permissionchmod 600 /home/user1/.ssh/identity10. Restart sshdNow, you can ssh or secure copy filles by using user1 from linux1 to linux2 without prompt

(出处:http://www.sheup.com)