当前位置导航:炫浪网>>网络学院>>操作系统>>Linux教程

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

    首先假定有两台linux机器,linux1和linux2。 你想从linux1向linux2拷贝机器时无需输入密码,或者是在ctontab中这样做。
1. 安装SSH
2. 创建两个用户,user1在linux1上,user2吱在linux2上。
3. On linux2, login as user2. do
ssh-keygen -P "" -trsa1 -f ~/.ssh/identity
4. Copy key file to linux1
scp /home/user2/.ssh/identity.pub user1@linux1:/home/user1/.ssh/authorized_keys
5. Change file permission
chmod 600 /home/user2/.ssh/authorized_keys
6. change ssh config file: /etc/ssh/ssh_config
Ad
Host *
ForwardX11 yes
IdentityFile ~/.ssh/identity
Protocol 1
7. Restart sshd
8. login to linux1 as user1.
9.Change file permission
chmod 600 /home/user1/.ssh/identity
10. Restart sshd
Now, you can ssh or secure copy filles by using user1 from linux1 to linux2 without prompt

相关内容
赞助商链接