I am trying to use rsync utility through ssh to synchronize some root files of 2 servers.
I have a rsyncusr user in each server. I configured ssh with no password. I set NOPASSWD in the /etc/sudoers file:
In order to make rsync able to sudo and be able to sync root files from one server to other server.
So far, I was not be able to transfer the files preserving the permissions (owner, group, etc).
To illustrate with an example. I have a file in the remote host dev3test:
I have 2 servers:
Local: roidev
remote: roidev3
First scenario:
If I try from the local host to pull the file from the remote host to the local host:
The file is transferred to the local host with the following permissions :
The owner and the group is changed.
Second scenario:
If I try from the remote host to push the file from the remote host to the local host:
I got the following error
Third scenario:
Loggin as a root user in the local host or in the remote host, executing the same commands:
I can get the transfer file with the right permissions, but I am requiring for rsyncusr password.
I can not loggin as root through the network, only I can do sudo.
I would like to know if there is a way to transfer root files preserving permissions as a different user and without password, using rsync with ssh.
thanks in advance
Samalogo
Last edited by zxmaus; 01-26-2012 at 12:26 AM..
Reason: please use code tags rather than colors - that saves us from having to use sunglasses to read your post
Your 3rd scenario seems to be better. Its just that you have to setup ssh key sharing for the rsyncusr. That should work.
Another option would be to set SGID bit on the folder on the local machine where the backup is getting stored. The owner group of the directory would be "system" and you may add root as the owner. Then, you can setup ACL to explicitly allow access for rsyncusr. The files written would be with "system" as the owner group. But, still "rsyncusr" will be the owner of the file.
I would suggest, you create home directory (if it's not already setup) for the rsyncusr in the remote machine and put the ssh public key in /home/rsyncuser/.ssh/authorized_keys
Actually, I setup in both servers the ssh keys. So if I am logging in one server as a rsyncusr and I prompt the ssh command to connect with the other server: "ssh rsyncusr@hostname", I can loggin without ask me for password in both ways. But in the third scenario I am logging as a root, so the system ask me for the rsyncusr password.
Hello All,
I am looking at a fast way to script some backups. I am looking at using rsync to do the leg work. I am having a hard time conceiving a script though.
I have a tree with subfolders within subfolders. I was looking at the /xd option to parse the tree.
Directory of k:\
... (4 Replies)
Hello,
I have a list of working directory in a remote computer acesssible through ssh and the same directory structure in my home directory of my laptop. I sometimes work on both my laptop and my this other computer.
I usually use Rsync this way to synchronize files
rsync... (5 Replies)
Hi Everyone,
we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment?
Thanks in adv. (0 Replies)
I'm using this script to backup an external hdd to another external hdd -
rsync -aE --delete --exclude Volumes/Disk\ A/.Trashes "/Volumes/Disk A" "/Volumes/Disk A Backup"The source drive being "Disk A", and the drive I wish to backup to being "Disk A Backup".
I'm constantly getting this error,... (4 Replies)
How do i use Rsync yo pickup only new or modified files from source?
I am using rsync -ravzpotu --delete-excluded but sometimes it goes thru all files again (5 Replies)
Hi
I would like to ask if rsync has an option of backing up the new or updated files on different destination dir( only the new or updated files will be copied to the a different dir) just like option --backup-dir but this is for backup files.
Thanks for any response. (1 Reply)
I've got a new MythTV box at home and figured it would be a great opportunity to use it to do daily mirrors of my mysqlbackup directory (let's say /mysqlbackup/backups) and my website at /usr/local/apache/htdocs and below.
I figured it would be a best practice NOT to use a root login but to... (0 Replies)
hello,
i need to modified my synch/back scripts....
i want that this script only syncro folders in destinationfolder.
f.e. when in destination are two folders
1) admin
2) users
but in SOURCE are three:
1) admin
2) users
3) antivirus
the script should only increnmential sync the... (0 Replies)
I want to take daily backup(11pm) of /var/www to /mnt/bak excluding /var/www/videos and /var/www/old. HOW to implement a rotating snapshot method, so that i can have multiple(say 4) automatically rotating backups. (0 Replies)