RSYNC With Username
and Password
On Server2:
In this example we have user2 and
password: PaSSWDUser2
yum install rsync
mkdir /home/user2/dir-server2
vi /home/user2/.rsyncd.secrets
user2:PaSSWDUser2
chmod 600 /home/user2/.rsyncd.secrets
vim /etc/rsyncd.conf
With content:
use
chroot = falselock file = /var/log/rsync.lock
log file = /var/log/rsyncd.log
pid file = /var/log/rsyncd.pid
[dir-server2]
path=/home/user2/dir-server2/
comment = Directory on Server2
uid = root
gid = root
read only = no
list = yes
auth users = user2
secrets file = /home/user2/.rsyncd.secrets
max connections = 10
hosts allow = 123.123.123.101
service iptables stop
rsync --daemon
On Server1:
In this example, we have user1 on
server1 with password: PaSSWDUser1
Create a file name and store only
the password of user2
vi /home/user1/.rsync.secrets
With content:
PaSSWDUser2
chmod 600 /home/user1/.rsync.secrets
chown user1:user1 /home/user1/.rsync.secrets
rsync -avz --password-file=/home/user1/.rsync.secrets
/home/user1/dir-server1/ user2@123.123.123.102::dir-server2
No comments:
Post a Comment