rsync只能用root用户运行服务端吗
发布网友
发布时间:2022-04-25 15:53
我来回答
共2个回答
热心网友
时间:2023-10-14 22:40
rsync -avP --delete root@192.168.0.2:/home/* /mkchen 意思
# rpm -qa |grep rsync #检查系统否安装rsync软件包
rsync-2.6.8-3.1
# rpm -ivh rsync-2.6.8-3.1.i386.rpm # 没安装则手安装
# vim /etc/xinetd.d/rsync
1 配置rsync servervi /etc/xinetd.d/rsync
disable=yes改no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2 配置rsync自启
# chkconfig rsync on
# chkconfig rsync --list
rsync on
3 配置rsyncd.conf
[root@test etc]# vim rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /srv
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
4 确保etc/servicesrsync端口号确
# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5 配置rsync密码(边配置文件已经写路径)/home/rsync.ps(名字随便写要边配置文件致即)格式(行用户)
# vi /home/rsync.ps
scihoo:scihoo
6 配置rsync密码文件权限
# chown root.root rsync.ps
# chmod 400 rsync.ps
7 启配置
# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 xinetd没需要安装
[root@test home]# yum -y install xinetd
启rsync server
RSYNC服务端启两种
9、启rsync服务端(独立启)
# /usr/bin/rsync --daemon
10、启rsync服务端 (xinetd超级进程启)
# /etc/init.d/xinetd reload
11 加入rc.local
各种操作系统rc文件存放位置尽相同修改使系统启rsync --daemon加载进
# vi /etc/rc.local
/usr/local/rsync –daemon #加入行
12 检查rsync否启
[root@test home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync (LISTEN)
客户端配置
1 配置三程
1.1 设定密码文件
1.2 测试rsync执行指令
1.3 rsync指令放入工作排程(crontab)
[root@aj1 home]# vi /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.1 配置密码文件 (注:安全设定密码档案属性:600rsync.ps密码定要Rsync Server密码设定案密码)
[root@aj1 home]# vi rsync.ps
sciooo
[root@aj1 home]# chown root.root .rsync.ps # 注意必须给权限
[root@aj1 home]# chmod 600 .rsync.ps # 必须修改权限
1.2 服务器载文件
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps scihoo@192.168.0.206::backup /home/
本传服务器
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps /home scihoo@192.168.0.206::backup
热心网友
时间:2023-10-14 22:41
如果不修改端口,采用默认端口需要用root用户启动,因为默认端口是873。