Hi, I'm trying to get an rsync updating some files without changing their owner, groups or permissions. I've read man pages etc. stating I need to use the "--no-o", "--no-g", "--no-p" flags, something like rsync -r --no-p --no-o --no-g source destination While the permissions are keeped, there is something not working as expected or I'm missing something about owner and group, at least when I run rsync as root/sudo. Just to get a quick (non-)working example, when I run this commands (delete files, create two different files, rsync them) as a non-root user: sudo rm /tmp/sample1 /tmp/sample2 2> /dev/null /bin/date > /tmp/sample1 sleep 3 /bin/date > /tmp/sample2 echo "Before rsync:" ls -l /tmp/sample1 /tmp/sample2 sudo rsync -r --no-o --no-g /tmp/sample1 /tmp/sample2 echo "After rsync:" ls -l /tmp/sample1 /tmp/sample2 I get this: Before rsync: -rw-r--r-- 1 user01 group01 30 jun 4 11:39 /tmp/sample1 -rw-r--r-- 1 user01 group01 30 jun 4 11:39 /tmp/sample2 After rsync: -rw-r--r-- 1 user01 group01 30 jun 4 11:39 /tmp/sample1 -rw-r--r-- 1 root root 30 jun 4 11:39 /tmp/sample2 I started with "rsync -azvhc" but I've stripped it to a minimum. Also I run "rsync" as root user ("su -", not "sudo") with the same results. Any help would be appreciated. Regards, -- Alberto Cabello S?nchez Servicio de Inform?tica Universidad de Extremadura
On Thu, Jun 4, 2020 at 3:07 AM Alberto Cabello S?nchez wrote:> I'm trying to get an rsync updating some files without changing their > owner, groups or permissions. I've read man pages etc. stating I need to > use the "--no-o", "--no-g", "--no-p" flags >You'll need to also specify --inplace in order for rsync to just use the existing files instead of creating a new one and moving it into place. Any new files will still be owned by the copying user (root in your case). If all the files are going to end up being owned by one particular user & group, you could instead include the -o & -g options along with the --chown=user:group option and the receiving side will create/chown all the files in the transfer on the receiving side to that user and group (without needing to use --inplace). ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20200604/a82b48d6/attachment.htm>
On Thu, 4 Jun 2020 09:35:46 -0700 Wayne Davison <wayne at opencoder.net> wrote:> On Thu, Jun 4, 2020 at 3:07 AM Alberto Cabello S?nchez wrote: > > > I'm trying to get an rsync updating some files without changing their > > owner, groups or permissions. I've read man pages etc. stating I need to > > use the "--no-o", "--no-g", "--no-p" flags > > > > You'll need to also specify --inplace in order for rsync to just use the > existing files instead of creating a new one and moving it into place. Any > new files will still be owned by the copying user (root in your case).Thank you very much, I already guessed new files would have some kind of default owner, group and permissions.> If all the files are going to end up being owned by one particular user & > group, you could instead include the -o & -g options along with the > --chown=user:group option and the receiving side will create/chown all the > files in the transfer on the receiving side to that user and group (without > needing to use --inplace).That will not be usually the case, but it can be useful in some scenarios. Thanks again, -- Alberto Cabello S?nchez Servicio de Inform?tica Universidad de Extremadura
Possibly Parallel Threads
- scp problem
- Unable to get primary group information when using AD authentication with samba-4.10.4
- How to Store the executed values in a dataframe & rle function
- computing marginal values based on multiple columns?
- phantom NA/NaN/Inf in foreign function call (or something altogether different?)