小谈rsync
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-03
|
chmod 600 /etc/rsyncd.pass //设置了用户读写的权限.
(本地主机 要建立此文件,只需要输入密码即可èLinux%@!shuji192)
本地主机(CLIENT):
[root@mail ~]# cat /etc/rsyncd.pass
Linux%@!shuji192
2.启动rsync服务程序:
启动rsync服务有两种方式:独立守护进程的启动和依赖于xinetd超级服务.
One:独立守护进程:
[root@server ~]# rsync –daemon //启动服务命令
[root@server ~]# echo "/usr/bin/rsync --daemon &" >> /etc/rc.local
//开机自动运行服务
Two:xinetd 超级管理进程
# default: off
# description: The rsync server is a good addition to an ftp server, as it
# allows crc checksumming etc.
service rsync
{
disable = yes #将yes改为no 重启服务即可
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure = USERID
}
[root@server ~]# service xinetd restart
停止 xinetd: [确定]
启动 xinetd: [确定]
[root@server ~]# chkconfig --list rsync
rsync 启用
下面我们来进行访问:
[root@mail ~]# rsync -avH root@192.168.0.110::/data /tmp
ERROR: The remote path must start with a module name not a /
rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=2.6.8]
为什么会出现错误信息呢?一定记住在rsync –-daemon 模式中,目录名对应远程主机所发布的模块名,验证用户为/etc/rsyncd.pass中定义的用户.
改过后的效果:
[root@mail ~]# rsync -avH root@192.168.0.110::data /tmp
Password:
receiving file list ... done
./
H3CSE.pdf
H3CTE.pdf
vnc.doc
Linux/
Linux/RHCA/
Linux/RHCA/xunihua/
Linux/rsync/
ccie.rar/
ccie.rar/tonghua.mp3
ccie.rar/BGP/
ccie.rar/MPLS/
ccie.rar/QOS/
ccie.rar/VPN/
ccie.rar/vlan-router/
ccna.rar/
ccna.rar/haoren
ccnp.tar/
ccnp.tar/oldboy.mp3
ccnp.tar/gvrp/
ccnp.tar/mul/
ccnp.tar/rstp/
ccnp.tar/stp/
ccnp.tar/vlan-qos/
ccnp.tar/vtp/
sent 344 bytes received 9401033 bytes 989618.63 bytes/sec
total size is 9398927 speedup is 1.00
或者使用[root@mail ~]# rsync -avH rsync://root@192.168.0.110/data /tmp命令,效果是一模一样的~~~
3.rsync常用命令
1. 查看rsync服务器的备份目录列表
[root@mail ~]# rsync rsync://192.168.0.110
data It''s my study data!
就一个共享目录,但不给力了,我想看看共享目录里面的详细信息,
[root@mail ~]# rsync rsync://root@192.168.0.110/data
Password:
drwxr-xr-x 4096 2011/06/02 10:20:13 .
-rw-r--r-- 3201 2011/06/02 10:19:41 H3CSE.pdf
-rw-r--r-- 8510 2011/06/02 10:18:52 H3CTE.pdf
-rw-r--r-- 2745 2011/06/02 10:17:53 vnc.doc
drwxr-xr-x 4096 2011/06/02 12:04:50 Linux
drwxr-xr-x 4096 2011/06/02 11:00:50 ccie.rar
drwxr-xr-x 4096 2011/06/02 10:22:40 ccna.rar
drwxr-xr-x 4096 2011/06/02 11:01:06 ccnp.tar
上传和下载的命令就不多做介绍了,上面的内容中已经清楚了吧~~~
还有一个大家一定很感兴趣的???
工作的需求, 对 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn
为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
|