Linux的两个机器间传送文件(中文版)

<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

如何可以不用密码在Linux之间传输文件

我们假设理由2个Linux( linux1 and linux2). 你想复制文件从linux1 到linux2不用密码,可以用crontab。

1. 安装SSH

2. 创建2个用户. user1在liunx1和user2在linux2.

3. 在linux2用user2登录

ssh-keygen -P "" -trsa1 -f ~/.ssh/identity

4. 复制密钥到linux1

scp /home/user2/.ssh/identity.pub user1@linux1:/home/user1/.ssh/authorized_keys

5. 修改SSH文件属性

chmod 600 /home/user2/.ssh/authorized_keys

6. 修改ssh配置文件 /etc/ssh/ssh_config

Ad
Host *
ForwardX11 yes
IdentityFile ~/.ssh/identity
Protocol 1

7. 重启SSHD

8. 用user1登录linux1

9.修改SSH文件属性

chmod 600 /home/user1/.ssh/identity

10. 重启SSHD

现在,你可以在user1在linux1和linux2之间用SSH安全的复制文件。

SCP命令

从本地导出到远程

[root@localhost ~]# scp /var/ALTEIL2/test_222.tsv root@192.168.0.77:/var/ALTEIL2/999.tsv

从远程导入到本地

[root@localhost ~]# scp root@192.168.0.77:/var/ALTEIL2/999.tsv /var/ALTEIL2/test_222.tsv
 
原文:
How to transfer files between two linux boxs without pwd

Let me guess you have two linux boxs ( linux1 and linux2). You want to copy files from linux1 to linux2 without password or do it at crontab.
1. Install SSH
2. Create two users. user1 at liunx1 and user2 at 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

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值