Brian J. Murrell
2012-Jul-27 17:26 UTC
cannot rsync when source directory lacks write permission
I seem to be running into a problem where I am trying to rsync from a source directory that lacks write permissions (i.e. r-xr-xr-x). Presumably this is because rsync creates the directory on the destination, then sets the permissions to match the source and then tries to sync the contents of the directory, which it cannot of course lacking write permission in the directory. Is there a way to have rsync first sync a directory and then set the permissions to match the source? Of course, this needs to be done recursively so that permissions are set as rsync ascends back up the directory tree. Cheers, b. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/rsync/attachments/20120727/07a56b0d/attachment.pgp>
josephj at main.nc.us
2012-Jul-27 18:12 UTC
cannot rsync when source directory lacks write permission
Is rsync being run with root privileges for the destination?> I seem to be running into a problem where I am trying to rsync from a > source directory that lacks write permissions (i.e. r-xr-xr-x). > Presumably this is because rsync creates the directory on the > destination, then sets the permissions to match the source and then > tries to sync the contents of the directory, which it cannot of course > lacking write permission in the directory. > > Is there a way to have rsync first sync a directory and then set the > permissions to match the source? Of course, this needs to be done > recursively so that permissions are set as rsync ascends back up the > directory tree. > > Cheers, > b. > > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: > https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Steven Levine
2012-Jul-27 18:14 UTC
cannot rsync when source directory lacks write permission
In <juuivm$ai5$1 at dough.gmane.org>, on 07/27/12 at 01:26 PM, "Brian J. Murrell" <brian at interlinx.bc.ca> said: Hi,>I seem to be running into a problem where I am trying to rsync from a >source directory that lacks write permissions (i.e. r-xr-xr-x). >Presumably this is because rsync creates the directory on the >destination, then sets the permissions to match the source and then tries >to sync the contents of the directory, which it cannot of course lacking >write permission in the directory.Rsync contains code to handle this. What version of rsync are you running and what is the command line you are using and what is the exact error message you are getting? Regards, Steven -- ---------------------------------------------------------------------- "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com ----------------------------------------------------------------------
András Porjesz
2012-Aug-07 05:57 UTC
cannot rsync when source directory lacks write permission
Hi, Probably it is related to this bug: https://bugzilla.samba.org/show_bug.cgi?id=8844 Andras -----Original Message----- From: rsync-bounces at lists.samba.org [mailto:rsync-bounces at lists.samba.org] On Behalf Of Steven Levine Sent: Friday, July 27, 2012 20:15 To: rsync at lists.samba.org Subject: Re: cannot rsync when source directory lacks write permission In <juuivm$ai5$1 at dough.gmane.org>, on 07/27/12 at 01:26 PM, "Brian J. Murrell" <brian at interlinx.bc.ca> said: Hi,>I seem to be running into a problem where I am trying to rsync from a >source directory that lacks write permissions (i.e. r-xr-xr-x). >Presumably this is because rsync creates the directory on the >destination, then sets the permissions to match the source and then >tries to sync the contents of the directory, which it cannot of course >lacking write permission in the directory.Rsync contains code to handle this. What version of rsync are you running and what is the command line you are using and what is the exact error message you are getting? Regards, Steven -- ---------------------------------------------------------------------- "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com ---------------------------------------------------------------------- -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Greg Deback (rsync)
2012-Aug-07 11:03 UTC
cannot rsync when source directory lacks write permission
Hi, No I think this bug is not related. However, I am wondering : if the directory is write-protected, even for root, that means it never changes right ? or is it that there is no file creation, only updates ? In either case, the better would be to treat this particular directory separately. Suppose this directory is called "secure", you would create a "secure" folder on the destination, with a chmod +w, then do : rsync $SRC $DST -x secure\* rsync $SRC/secure $DST/secure/ Greg On Tue, Aug 7, 2012 at 7:57 AM, Andr?s Porjesz <andras.porjesz at ericsson.com>wrote:> Hi, > Probably it is related to this bug: > https://bugzilla.samba.org/show_bug.cgi?id=8844 > Andras > > -----Original Message----- > From: rsync-bounces at lists.samba.org [mailto:rsync-bounces at lists.samba.org] > On Behalf Of Steven Levine > Sent: Friday, July 27, 2012 20:15 > To: rsync at lists.samba.org > Subject: Re: cannot rsync when source directory lacks write permission > > In <juuivm$ai5$1 at dough.gmane.org>, on 07/27/12 > at 01:26 PM, "Brian J. Murrell" <brian at interlinx.bc.ca> said: > > Hi, > > >I seem to be running into a problem where I am trying to rsync from a > >source directory that lacks write permissions (i.e. r-xr-xr-x). > >Presumably this is because rsync creates the directory on the > >destination, then sets the permissions to match the source and then > >tries to sync the contents of the directory, which it cannot of course > >lacking write permission in the directory. > > Rsync contains code to handle this. What version of rsync are you running > and what is the command line you are using and what is the exact error > message you are getting? > > Regards, > > Steven > > -- > ---------------------------------------------------------------------- > "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. > www.scoug.com www.ecomstation.com > ---------------------------------------------------------------------- > > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: > https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: > https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20120807/1754e101/attachment.html>
Steven Levine
2012-Aug-07 22:16 UTC
cannot rsync when source directory lacks write permission
In <CAFUyVX4O-o=r36MA0sMfhMMiPZSurLg3V0Z=QX_v1Bz099ggHw at mail.gmail.com>, on 08/07/12 at 01:03 PM, "Greg Deback (rsync)" <greg.deb+rsync at gmail.com> said: Hi,>No I think this bug is not related. However, I am wondering : if the >directory is write-protected, even for root, that means it never changes >right ?No. As the code says /* We need to ensure that the dirs in the transfer have both * readable and writable permissions during the time we are * putting files within them. This is then restored to the * former permissions after the transfer is done. */ If Andr?s can not create files and/or dirctories at the destination, it is because the directory does not already have the required read/write permissions or the rsync daemon does not have the authority to change the permissions. Regards, Steven -- ---------------------------------------------------------------------- "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com ----------------------------------------------------------------------
András Porjesz
2012-Aug-08 06:29 UTC
cannot rsync when source directory lacks write permission
Hi Steven, In my case rsyncd runs as root, so it must have right to do the job. Rsync started with -p, but the daemon could not write into the destination area, because the [newly created] directories were owned by "nobody" and "other" had no right to write into it. The solution (workaround) was to add this line to the config of the daemon: uid=root. I have no any idea why it works, why it has any effect at all and why it was not documented if it was required to use --perms. Andras -----Original Message----- From: rsync-bounces at lists.samba.org [mailto:rsync-bounces at lists.samba.org] On Behalf Of Steven Levine Sent: Wednesday, August 08, 2012 00:16 To: rsync at lists.samba.org Subject: Re: cannot rsync when source directory lacks write permission In <CAFUyVX4O-o=r36MA0sMfhMMiPZSurLg3V0Z=QX_v1Bz099ggHw at mail.gmail.com>, on 08/07/12 at 01:03 PM, "Greg Deback (rsync)" <greg.deb+rsync at gmail.com> said: Hi,>No I think this bug is not related. However, I am wondering : if the >directory is write-protected, even for root, that means it never >changes right ?No. As the code says /* We need to ensure that the dirs in the transfer have both * readable and writable permissions during the time we are * putting files within them. This is then restored to the * former permissions after the transfer is done. */ If Andr?s can not create files and/or dirctories at the destination, it is because the directory does not already have the required read/write permissions or the rsync daemon does not have the authority to change the permissions. Regards, Steven -- ---------------------------------------------------------------------- "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com ---------------------------------------------------------------------- -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
András Porjesz
2012-Aug-10 07:27 UTC
cannot rsync when source directory lacks write permission
Steven, Of course, the destination side must have enough rights to achieve what I need, and an rsyncd running as root:root surely have all the necessary rights. So using --perms with this daemon must have been sufficient. But not, it is simply not true, because the daemon has a built-in "assumption" which overkills it. I know rsync sends its command line parameters to the daemon, so rsyncd could have been able to handle the case, but instead of recognizing the flag it simply makes that assumption. I think all the permission/ownership handling is complicated (unaccountable, puzzling, peculiar) and the usage is confusing and annoying, it should be reworked in a much more consistent way: 1. use exactly the same options on both sides 2. specify which attributes to transfer (keep) and which ones to set explicitly (including permissions, ownership, time and probably acl also) 3. define defaults 4. define a precedence (like: source filesystem, sender config, receiver config, receiver user rights, defaults) 5. describe actions taken in case of insufficient rights (just another example: client side -E, server side incoming chmod u+x,g-x and outgoing chmod u+x,g-x: what is the expected result when sending or receiving files?) Using aliases these can be mapped to the actual flags - for backward compatibility Andras -----Original Message----- From: rsync-bounces at lists.samba.org [mailto:rsync-bounces at lists.samba.org] On Behalf Of Steven Levine Sent: Thursday, August 09, 2012 21:37 To: rsync at lists.samba.org Subject: RE: cannot rsync when source directory lacks write permission In <64FAB8215D47A944ABDF7DE50A3406A219C2DAC909 at ESESSCMS0353.eemea.ericsson.se>, on 08/09/12 at 07:54 AM, Andr?s Porjesz <andras.porjesz at ericsson.com> said: Hi,>Thanks, it looks ok, just it is not documented anywhere:>From the ryncd.conf man pageuid This parameter specifies the user name or user ID that file transfers to and from that module should take place as when the daemon was run as root. In combination with the gid parameter this determines what file permissions are available. The default is uid -2, which is normally the user nobody.>it overwrites >the -perms flag on the other side.Not really. Se below.>So read documentation, it is >definitely against it: "In summary: to give destination files (both old >and new) the source permissions, use --perms."I assume you are referring to the rsync man page which says -p, --perms This option causes the receiving rsync to set the destination permissions to be the same as the source permissions. (See also the --chmod option for a way to modify what rsync considers to be the source permissions.) What it does not say is that the receiving side needs sufficient permissions to be able to change the permissions. I guess the man page authors assumed that someone running rsync on *ix would understand this implicitly. Running the receiving side as root is one option for ensuring that the receiver can change permissions. There are others that are more secure. Running the receiver as the default nobody user does not turn off --perms, it simply ensures that the attempt to change permissions is very likely to fail. One way to make it not fail is to have the module root owned by nobody. Regards, Steven -- ---------------------------------------------------------------------- "Steven Levine" <steve53 at earthlink.net> eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com ---------------------------------------------------------------------- -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html