holeryu 发表于 2007-07-31 10:07

实战solaris之RCP命令


    实战solaris之RCP命令使用:permission denied; .rhosts;/etc/hosts。
非常好用的命令,配置、使用该命令省去了利用第三方ftp服务器实现文件传输的麻烦。很容易实现在两台solaris主机之间的文件传输。

现有两台机器,IP地址是212.25.254.41和212.25.254.42,做负载均衡的,也就是说两台机器的配置是相同的,每次更新其中一台机器测试没问题后,同时将另外一台机器更新,一般更新是通过第三方的ftp服务传递文件,确实这种方式相对麻烦,最近发现solaris 的rcp命令可是实现远程拷贝,这种方式较ftp的那种方式方便了很多,于是就登录其中一台机器212.25.254.41试了一下:
   #rcp
   usage: rcp [-p] f1 f2; or: rcp [-rp] f1 ... fn directory
#rcp 212.25.254.42:/export/home/pin/data/main.log main.log
本想上面的命令执行的结果应该是将212.25.254.41上的main.log文件copy到本地,但是执行结果:
permission denied
不理解,遂到google搜了一下,大概了解说要用主机名,不能用ip,就是说,如果
212.25.254.42 的主机名是test1; 212.25.254.42 的主机名是test2,通过/etc/hosts文件配置
127.0.0.1       localhost
212.25.254.41   test1
212.25.254.42   test2
那么前面执行的命令应该是这样:
#rcp test2:/export/home/pin/data/main.log main.log
但是还是得不到预期结果。 通过google搜索到要在连接的用户根目录下配置.rhosts文件,遂根据说明调整:
test1
vi /etc/hosts
212.25.254.41    test1
212.25.254.42    test2
vi $HOME/.rhosts
test2 pin

test2
vi /etc/hosts
212.25.254.41    test1
212.25.254.42    test2

vi $HOME/.rhosts
test1 pin

再次执行
# rcp test2:/export/home/pin/data/main.log main.log
成功。
http://control.cublog.cn/fileicon/rar.gif
文件:
实战solaris之rcp.rar
大小:
4KB
下载:
下载
holer
holeryu@hotmail.com
http://holeryu.cublog.cn/
http://blog.csdn.net/holeryu/


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16991/showart_350576.html
页: [1]
查看完整版本: 实战solaris之RCP命令