rsync sends file to remote daemon server but keeps original ownership and group











up vote
1
down vote

favorite












When running the following command, I hope the ownership and group id (o-and-g) is remained in the remote rsync daemon server. However, every file has the o-and-g the same as configured in rsync.conf, [uid] and [gid].



sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} rsync_backup@[ipv6]::backupfiles --password-file=/etc/rsyncd.passonly


So my question is, how to keep the same o and g instead of using the ones in rsync.conf? Do these users and groups need to be present on that server?










share|improve this question




























    up vote
    1
    down vote

    favorite












    When running the following command, I hope the ownership and group id (o-and-g) is remained in the remote rsync daemon server. However, every file has the o-and-g the same as configured in rsync.conf, [uid] and [gid].



    sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} rsync_backup@[ipv6]::backupfiles --password-file=/etc/rsyncd.passonly


    So my question is, how to keep the same o and g instead of using the ones in rsync.conf? Do these users and groups need to be present on that server?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      When running the following command, I hope the ownership and group id (o-and-g) is remained in the remote rsync daemon server. However, every file has the o-and-g the same as configured in rsync.conf, [uid] and [gid].



      sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} rsync_backup@[ipv6]::backupfiles --password-file=/etc/rsyncd.passonly


      So my question is, how to keep the same o and g instead of using the ones in rsync.conf? Do these users and groups need to be present on that server?










      share|improve this question















      When running the following command, I hope the ownership and group id (o-and-g) is remained in the remote rsync daemon server. However, every file has the o-and-g the same as configured in rsync.conf, [uid] and [gid].



      sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} rsync_backup@[ipv6]::backupfiles --password-file=/etc/rsyncd.passonly


      So my question is, how to keep the same o and g instead of using the ones in rsync.conf? Do these users and groups need to be present on that server?







      linux rsync






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 1:37

























      asked Nov 20 at 10:49









      Tiina

      5781614




      5781614






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          rsync can only change the owner and group to the original when running as root. As you have apparently set a non-root UID in the rsyncd.conf file, rsync can only store files as that user. This is a security measure imposed by the operating system, so that ordinary users cannot create files and change the owner to some other user.






          share|improve this answer





















          • Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
            – Gordon Davisson
            Nov 20 at 17:27










          • if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
            – Tiina
            Nov 21 at 1:38










          • @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
            – wurtel
            yesterday











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376929%2frsync-sends-file-to-remote-daemon-server-but-keeps-original-ownership-and-group%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          rsync can only change the owner and group to the original when running as root. As you have apparently set a non-root UID in the rsyncd.conf file, rsync can only store files as that user. This is a security measure imposed by the operating system, so that ordinary users cannot create files and change the owner to some other user.






          share|improve this answer





















          • Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
            – Gordon Davisson
            Nov 20 at 17:27










          • if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
            – Tiina
            Nov 21 at 1:38










          • @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
            – wurtel
            yesterday















          up vote
          3
          down vote



          accepted










          rsync can only change the owner and group to the original when running as root. As you have apparently set a non-root UID in the rsyncd.conf file, rsync can only store files as that user. This is a security measure imposed by the operating system, so that ordinary users cannot create files and change the owner to some other user.






          share|improve this answer





















          • Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
            – Gordon Davisson
            Nov 20 at 17:27










          • if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
            – Tiina
            Nov 21 at 1:38










          • @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
            – wurtel
            yesterday













          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          rsync can only change the owner and group to the original when running as root. As you have apparently set a non-root UID in the rsyncd.conf file, rsync can only store files as that user. This is a security measure imposed by the operating system, so that ordinary users cannot create files and change the owner to some other user.






          share|improve this answer












          rsync can only change the owner and group to the original when running as root. As you have apparently set a non-root UID in the rsyncd.conf file, rsync can only store files as that user. This is a security measure imposed by the operating system, so that ordinary users cannot create files and change the owner to some other user.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 10:53









          wurtel

          1,19647




          1,19647












          • Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
            – Gordon Davisson
            Nov 20 at 17:27










          • if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
            – Tiina
            Nov 21 at 1:38










          • @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
            – wurtel
            yesterday


















          • Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
            – Gordon Davisson
            Nov 20 at 17:27










          • if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
            – Tiina
            Nov 21 at 1:38










          • @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
            – wurtel
            yesterday
















          Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
          – Gordon Davisson
          Nov 20 at 17:27




          Note that running rsync with sudo runs it as root on the local computer, but has no effect on the remote computer.
          – Gordon Davisson
          Nov 20 at 17:27












          if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
          – Tiina
          Nov 21 at 1:38




          if a local file has owner Tom, does he has to be present on remote rsync daemon server host?
          – Tiina
          Nov 21 at 1:38












          @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
          – wurtel
          yesterday




          @Tiina if you use --numeric-ids then only the numeric values of the UID and GID are transferred; normally rsync -og will try to preserve the owner and group by name, even if the numeric values are different (e.g. Tom has uid 123 on the source and uid 234 on the destination, then Tom's files will have uid 234 on the destination; with --numeric-ids then Tom won't own those files on the destination). If no match can be found for the name, then the numeric value will be used anyway.
          – wurtel
          yesterday


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376929%2frsync-sends-file-to-remote-daemon-server-but-keeps-original-ownership-and-group%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AnyDesk - Fatal Program Failure

          How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

          QoS: MAC-Priority for clients behind a repeater