scp 不需要输入密码拷贝

rcp, scp, rexec 等命令很方便,rcp 建立信任主机(即$HOME/.rhosts)配置即可,scp需要秘钥

下面配置scp秘钥的过程,可以在不同机器之间互相拷贝

<1762 hostname [currentuser] :/home/currentuser>ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/currentuser/.ssh/id_rsa): Enter
Created directory '/home/currentuser/.ssh'.
Enter passphrase (empty for no passphrase): Enter
Enter same passphrase again: Enter
Your identification has been saved in /home/currentuser/.ssh/id_rsa.
Your public key has been saved in /home/currentuser/.ssh/id_rsa.pub.
The key fingerprint is:
44:05:90:b0:34:07:6d:61:29:6d:ee:33:39:35:fa:25 currentuser@hostname
<1763 hostname [currentuser] :/home/currentuser>
<1763 hostname [currentuser] :/home/currentuser>cd .ssh
<1764 hostname [currentuser] :/home/currentuser/.ssh>ls
id_rsa      id_rsa.pub
<1765 hostname [currentuser] :/home/currentuser/.ssh>scp id_rsa.pub xxx.xxx.xxx.xxx:/home/currentuser/.ssh/authorized_keys
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
 RSA key fingerprint is 59:f9:b7:2a:94:ba:bd:6b:05:4a:40:c0:e9:1e:74:23.
 Are you sure you want to continue connecting (yes/no)?yes
Warning: Permanently added 'xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
currentuser@xxx.xxx.xxx.xxx's password:
id_rsa.pub                                                                                        100%  220     0.2KB/s   00:00   
<1766 hostname [currentuser] :/home/currentuser/.ssh>ls
id_rsa       id_rsa.pub   known_hosts
<1767 hostname [currentuser] :/home/currentuser/.ssh>ls -lrt
total 24
-rw-r--r--    1 currentuser      currentgroup         220 Jul 25 16:12 id_rsa.pub
-rw-------    1 currentuser      currentgroup         887 Jul 25 16:12 id_rsa
-rw-r--r--    1 currentuser      currentgroup         393 Jul 25 16:12 known_hosts
<1768 hostname [currentuser] :/home/currentuser/.ssh>cd ..
<1771 hostname [currentuser] :/home/currentuser/userfile/lc>scp mylist xxx.xxx.xxx.xxx:/home/currentuser/userfile/              
mylist                                                                                            100%   13     0.0KB/s   00:00 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值