Preserving file and folder permissions with rsyncHow to setup linux permissions for the WWW folder?Rsync Permissions from One Server to Another - Mkdir Permission denied (13)sshd_config ForceCommand /usr/bin/rsync error “connection unexpectedly closed”command parameter in .ssh/authorized_keysRsync + public key authentication securityrsync backup remote server maintaining groups and ownerBackup maildir to windows cifs sharersync maintaining ownership and permissions between linux and windows sshRsync to remote server and change file / directory ownershipsWhy does rsync+cron fail with opendir permission denied?

What does a yield inside a yield do?

Does a wine bottle stopper require tevillah?

Python password manager

Unknowingly ran an infinite loop in terminal

Do I really need diodes to receive MIDI?

How to improve/restore vintage Peugeot bike, or is it even worth it?

In Avengers 1, why does Thanos need Loki?

Selecting a secure PIN for building access

Missed the connecting flight, separate tickets on same airline - who is responsible?

How to give very negative feedback gracefully?

Quoting Yourself

Why is Arya visibly scared in the library in S8E3?

How could a planet have most of its water in the atmosphere?

Returning the outputs of a nested structure

What happens to matryoshka Mordenkainen's Magnificent Mansions?

What are the spoon bit of a spoon and fork bit of a fork called?

Airbnb - host wants to reduce rooms, can we get refund?

Is Cola "probably the best-known" Latin word in the world? If not, which might it be?

Why wasn't the Night King naked in S08E03?

How do I tell my manager that his code review comment is wrong?

Reconstruct a matrix from its traces

Would glacier 'trees' be plausible?

How can I get a job without pushing my family's income into a higher tax bracket?

Can Ghost kill White Walkers or Wights?



Preserving file and folder permissions with rsync


How to setup linux permissions for the WWW folder?Rsync Permissions from One Server to Another - Mkdir Permission denied (13)sshd_config ForceCommand /usr/bin/rsync error “connection unexpectedly closed”command parameter in .ssh/authorized_keysRsync + public key authentication securityrsync backup remote server maintaining groups and ownerBackup maildir to windows cifs sharersync maintaining ownership and permissions between linux and windows sshRsync to remote server and change file / directory ownershipsWhy does rsync+cron fail with opendir permission denied?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








6















I maintain a backup of my email accounts using this command:



sudo rsync -av --delete --progress -e "ssh -p pNumber" --rsync-path="/usr/bin/rsync" /vmail/ user@my_backup_server:/home/user/backups/vmail/



Source:
Most email folders are owned by user vmail.



Destination (backup server):
System doesn't have a user named vmail.



My question, would the above command preserve file and directory permissions even if destination machine doesn't have a user named vmail? Would it be possible to restore the files and permissions completely from destination to source even if the user names between the two machines are not the same (some missing on backup server).










share|improve this question




























    6















    I maintain a backup of my email accounts using this command:



    sudo rsync -av --delete --progress -e "ssh -p pNumber" --rsync-path="/usr/bin/rsync" /vmail/ user@my_backup_server:/home/user/backups/vmail/



    Source:
    Most email folders are owned by user vmail.



    Destination (backup server):
    System doesn't have a user named vmail.



    My question, would the above command preserve file and directory permissions even if destination machine doesn't have a user named vmail? Would it be possible to restore the files and permissions completely from destination to source even if the user names between the two machines are not the same (some missing on backup server).










    share|improve this question
























      6












      6








      6


      1






      I maintain a backup of my email accounts using this command:



      sudo rsync -av --delete --progress -e "ssh -p pNumber" --rsync-path="/usr/bin/rsync" /vmail/ user@my_backup_server:/home/user/backups/vmail/



      Source:
      Most email folders are owned by user vmail.



      Destination (backup server):
      System doesn't have a user named vmail.



      My question, would the above command preserve file and directory permissions even if destination machine doesn't have a user named vmail? Would it be possible to restore the files and permissions completely from destination to source even if the user names between the two machines are not the same (some missing on backup server).










      share|improve this question














      I maintain a backup of my email accounts using this command:



      sudo rsync -av --delete --progress -e "ssh -p pNumber" --rsync-path="/usr/bin/rsync" /vmail/ user@my_backup_server:/home/user/backups/vmail/



      Source:
      Most email folders are owned by user vmail.



      Destination (backup server):
      System doesn't have a user named vmail.



      My question, would the above command preserve file and directory permissions even if destination machine doesn't have a user named vmail? Would it be possible to restore the files and permissions completely from destination to source even if the user names between the two machines are not the same (some missing on backup server).







      linux backup permissions rsync






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 23 at 13:31









      W.M.W.M.

      1353




      1353




















          3 Answers
          3






          active

          oldest

          votes


















          4














          What rsync copies is the numerical user id of the file, regardless if it exists on the target system. If a user with that id doesn't exist, ls etc. will just show that number instead of a name. If that user id belongs to another username on the target system, this user will now own the file.



          Backup and restore will work without a problem in this scenario.






          share|improve this answer


















          • 2





            By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

            – HBruijn
            Apr 23 at 13:56



















          10














          How rsync preserves ownership of files depends on two things:



          • Are you super-user (root) on the destination?

            Otherwise you can't create files and directories with a different user other than your own.


          • Which option flags are you using?


          The -a option includes the -o, --owner, -g, --group options designed to preserve ownership.



          At the file-system level user and group ownership is stored in UID resp. GID numbers. When there is no mapping from UID/GID's to usernames and groupnames tools will simply display those numbers instead.

          Users and groups with the same names can have different UID/GID numbers on different systems.



          By default rsync will try to match the ownership by username resp. groupname. In other words when the user vmail is the owner of a file at the source, rsync will make the user vmail also the owner at the destination (even when they have different UID/GID numbers).

          That is usually quite resilient and the most predictable for humans as we normally don't look at ownership in the form of UID/GID numbers.



          When no matching user vmail is present on the remote destination, then a fall-back scenario will happen. Rsync will then preserve the actual underlying UID/GID numbers and the UID number of the vmail user on the source will used to set the owner.



          That should preserver the correct ownership when you reverse the rsync direction and restore the backup.



          man rsync :



           -o, --owner
          This option causes rsync to set the owner of the destination file to be the same as the source file,
          but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super
          options). Without this option, the owner of new and/or transferred files are set to the invoking user
          on the receiving side.

          The preservation of ownership will associate matching names by default, but may fall back to using the
          ID number in some circumstances (see also the --numeric-ids option for a full discussion).


          --numeric-ids
          With this option rsync will transfer numeric group and user IDs rather than using user and group names
          and mapping them at both ends.

          By default rsync will use the username and groupname to determine what ownership to give files. The
          special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids
          option is not specified.

          If a user or group has no name on the source system or it has no match on the destination system, then
          the numeric ID from the source system is used instead. See also the comments on the "use chroot" set‐
          ting in the rsyncd.conf manpage for information on how the chroot setting affects rsync’s ability to
          look up the names of the users and groups and what you can do about it.





          share|improve this answer

























          • Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

            – W.M.
            Apr 23 at 15:06






          • 2





            As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

            – HBruijn
            Apr 23 at 15:12


















          2














          With your case specifically, the real issue arises when it comes time to restore the files. The key would be to specify the desired owner/group when you pull the files back. --chown=vmail:vmail



          Assuming that you've already created the user vmail on the new machine to which you will restore, you'd issue something like the following:



          sudo rsync -av --chown=vmail:vmail --force --delete --progress user@my_backup_server:/home/user/backups/vmail/ /vmail/


          Doing it this way means it doesn't matter who owns the files on the backup server so long as you can rsync to/from that user (which is implied as already being true in your example).






          share|improve this answer








          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















          • Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

            – Tonin
            Apr 24 at 18:02






          • 1





            Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

            – HBruijn
            Apr 24 at 21:18












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          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',
          autoActivateHeartbeat: false,
          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%2fserverfault.com%2fquestions%2f964229%2fpreserving-file-and-folder-permissions-with-rsync%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          What rsync copies is the numerical user id of the file, regardless if it exists on the target system. If a user with that id doesn't exist, ls etc. will just show that number instead of a name. If that user id belongs to another username on the target system, this user will now own the file.



          Backup and restore will work without a problem in this scenario.






          share|improve this answer


















          • 2





            By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

            – HBruijn
            Apr 23 at 13:56
















          4














          What rsync copies is the numerical user id of the file, regardless if it exists on the target system. If a user with that id doesn't exist, ls etc. will just show that number instead of a name. If that user id belongs to another username on the target system, this user will now own the file.



          Backup and restore will work without a problem in this scenario.






          share|improve this answer


















          • 2





            By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

            – HBruijn
            Apr 23 at 13:56














          4












          4








          4







          What rsync copies is the numerical user id of the file, regardless if it exists on the target system. If a user with that id doesn't exist, ls etc. will just show that number instead of a name. If that user id belongs to another username on the target system, this user will now own the file.



          Backup and restore will work without a problem in this scenario.






          share|improve this answer













          What rsync copies is the numerical user id of the file, regardless if it exists on the target system. If a user with that id doesn't exist, ls etc. will just show that number instead of a name. If that user id belongs to another username on the target system, this user will now own the file.



          Backup and restore will work without a problem in this scenario.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 23 at 13:41









          SvenSven

          88k10148202




          88k10148202







          • 2





            By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

            – HBruijn
            Apr 23 at 13:56













          • 2





            By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

            – HBruijn
            Apr 23 at 13:56








          2




          2





          By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

          – HBruijn
          Apr 23 at 13:56






          By default rsync will use the username and groupname to determine what ownership to give files on the remote system, not the UID/GID numbers. If a user or group has no name on the source system or it has no match on the destination system, only then the numeric ID from the source system will be used.

          – HBruijn
          Apr 23 at 13:56














          10














          How rsync preserves ownership of files depends on two things:



          • Are you super-user (root) on the destination?

            Otherwise you can't create files and directories with a different user other than your own.


          • Which option flags are you using?


          The -a option includes the -o, --owner, -g, --group options designed to preserve ownership.



          At the file-system level user and group ownership is stored in UID resp. GID numbers. When there is no mapping from UID/GID's to usernames and groupnames tools will simply display those numbers instead.

          Users and groups with the same names can have different UID/GID numbers on different systems.



          By default rsync will try to match the ownership by username resp. groupname. In other words when the user vmail is the owner of a file at the source, rsync will make the user vmail also the owner at the destination (even when they have different UID/GID numbers).

          That is usually quite resilient and the most predictable for humans as we normally don't look at ownership in the form of UID/GID numbers.



          When no matching user vmail is present on the remote destination, then a fall-back scenario will happen. Rsync will then preserve the actual underlying UID/GID numbers and the UID number of the vmail user on the source will used to set the owner.



          That should preserver the correct ownership when you reverse the rsync direction and restore the backup.



          man rsync :



           -o, --owner
          This option causes rsync to set the owner of the destination file to be the same as the source file,
          but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super
          options). Without this option, the owner of new and/or transferred files are set to the invoking user
          on the receiving side.

          The preservation of ownership will associate matching names by default, but may fall back to using the
          ID number in some circumstances (see also the --numeric-ids option for a full discussion).


          --numeric-ids
          With this option rsync will transfer numeric group and user IDs rather than using user and group names
          and mapping them at both ends.

          By default rsync will use the username and groupname to determine what ownership to give files. The
          special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids
          option is not specified.

          If a user or group has no name on the source system or it has no match on the destination system, then
          the numeric ID from the source system is used instead. See also the comments on the "use chroot" set‐
          ting in the rsyncd.conf manpage for information on how the chroot setting affects rsync’s ability to
          look up the names of the users and groups and what you can do about it.





          share|improve this answer

























          • Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

            – W.M.
            Apr 23 at 15:06






          • 2





            As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

            – HBruijn
            Apr 23 at 15:12















          10














          How rsync preserves ownership of files depends on two things:



          • Are you super-user (root) on the destination?

            Otherwise you can't create files and directories with a different user other than your own.


          • Which option flags are you using?


          The -a option includes the -o, --owner, -g, --group options designed to preserve ownership.



          At the file-system level user and group ownership is stored in UID resp. GID numbers. When there is no mapping from UID/GID's to usernames and groupnames tools will simply display those numbers instead.

          Users and groups with the same names can have different UID/GID numbers on different systems.



          By default rsync will try to match the ownership by username resp. groupname. In other words when the user vmail is the owner of a file at the source, rsync will make the user vmail also the owner at the destination (even when they have different UID/GID numbers).

          That is usually quite resilient and the most predictable for humans as we normally don't look at ownership in the form of UID/GID numbers.



          When no matching user vmail is present on the remote destination, then a fall-back scenario will happen. Rsync will then preserve the actual underlying UID/GID numbers and the UID number of the vmail user on the source will used to set the owner.



          That should preserver the correct ownership when you reverse the rsync direction and restore the backup.



          man rsync :



           -o, --owner
          This option causes rsync to set the owner of the destination file to be the same as the source file,
          but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super
          options). Without this option, the owner of new and/or transferred files are set to the invoking user
          on the receiving side.

          The preservation of ownership will associate matching names by default, but may fall back to using the
          ID number in some circumstances (see also the --numeric-ids option for a full discussion).


          --numeric-ids
          With this option rsync will transfer numeric group and user IDs rather than using user and group names
          and mapping them at both ends.

          By default rsync will use the username and groupname to determine what ownership to give files. The
          special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids
          option is not specified.

          If a user or group has no name on the source system or it has no match on the destination system, then
          the numeric ID from the source system is used instead. See also the comments on the "use chroot" set‐
          ting in the rsyncd.conf manpage for information on how the chroot setting affects rsync’s ability to
          look up the names of the users and groups and what you can do about it.





          share|improve this answer

























          • Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

            – W.M.
            Apr 23 at 15:06






          • 2





            As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

            – HBruijn
            Apr 23 at 15:12













          10












          10








          10







          How rsync preserves ownership of files depends on two things:



          • Are you super-user (root) on the destination?

            Otherwise you can't create files and directories with a different user other than your own.


          • Which option flags are you using?


          The -a option includes the -o, --owner, -g, --group options designed to preserve ownership.



          At the file-system level user and group ownership is stored in UID resp. GID numbers. When there is no mapping from UID/GID's to usernames and groupnames tools will simply display those numbers instead.

          Users and groups with the same names can have different UID/GID numbers on different systems.



          By default rsync will try to match the ownership by username resp. groupname. In other words when the user vmail is the owner of a file at the source, rsync will make the user vmail also the owner at the destination (even when they have different UID/GID numbers).

          That is usually quite resilient and the most predictable for humans as we normally don't look at ownership in the form of UID/GID numbers.



          When no matching user vmail is present on the remote destination, then a fall-back scenario will happen. Rsync will then preserve the actual underlying UID/GID numbers and the UID number of the vmail user on the source will used to set the owner.



          That should preserver the correct ownership when you reverse the rsync direction and restore the backup.



          man rsync :



           -o, --owner
          This option causes rsync to set the owner of the destination file to be the same as the source file,
          but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super
          options). Without this option, the owner of new and/or transferred files are set to the invoking user
          on the receiving side.

          The preservation of ownership will associate matching names by default, but may fall back to using the
          ID number in some circumstances (see also the --numeric-ids option for a full discussion).


          --numeric-ids
          With this option rsync will transfer numeric group and user IDs rather than using user and group names
          and mapping them at both ends.

          By default rsync will use the username and groupname to determine what ownership to give files. The
          special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids
          option is not specified.

          If a user or group has no name on the source system or it has no match on the destination system, then
          the numeric ID from the source system is used instead. See also the comments on the "use chroot" set‐
          ting in the rsyncd.conf manpage for information on how the chroot setting affects rsync’s ability to
          look up the names of the users and groups and what you can do about it.





          share|improve this answer















          How rsync preserves ownership of files depends on two things:



          • Are you super-user (root) on the destination?

            Otherwise you can't create files and directories with a different user other than your own.


          • Which option flags are you using?


          The -a option includes the -o, --owner, -g, --group options designed to preserve ownership.



          At the file-system level user and group ownership is stored in UID resp. GID numbers. When there is no mapping from UID/GID's to usernames and groupnames tools will simply display those numbers instead.

          Users and groups with the same names can have different UID/GID numbers on different systems.



          By default rsync will try to match the ownership by username resp. groupname. In other words when the user vmail is the owner of a file at the source, rsync will make the user vmail also the owner at the destination (even when they have different UID/GID numbers).

          That is usually quite resilient and the most predictable for humans as we normally don't look at ownership in the form of UID/GID numbers.



          When no matching user vmail is present on the remote destination, then a fall-back scenario will happen. Rsync will then preserve the actual underlying UID/GID numbers and the UID number of the vmail user on the source will used to set the owner.



          That should preserver the correct ownership when you reverse the rsync direction and restore the backup.



          man rsync :



           -o, --owner
          This option causes rsync to set the owner of the destination file to be the same as the source file,
          but only if the receiving rsync is being run as the super-user (see also the --super and --fake-super
          options). Without this option, the owner of new and/or transferred files are set to the invoking user
          on the receiving side.

          The preservation of ownership will associate matching names by default, but may fall back to using the
          ID number in some circumstances (see also the --numeric-ids option for a full discussion).


          --numeric-ids
          With this option rsync will transfer numeric group and user IDs rather than using user and group names
          and mapping them at both ends.

          By default rsync will use the username and groupname to determine what ownership to give files. The
          special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids
          option is not specified.

          If a user or group has no name on the source system or it has no match on the destination system, then
          the numeric ID from the source system is used instead. See also the comments on the "use chroot" set‐
          ting in the rsyncd.conf manpage for information on how the chroot setting affects rsync’s ability to
          look up the names of the users and groups and what you can do about it.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 23 at 14:38

























          answered Apr 23 at 14:33









          HBruijnHBruijn

          57.3k1190152




          57.3k1190152












          • Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

            – W.M.
            Apr 23 at 15:06






          • 2





            As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

            – HBruijn
            Apr 23 at 15:12

















          • Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

            – W.M.
            Apr 23 at 15:06






          • 2





            As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

            – HBruijn
            Apr 23 at 15:12
















          Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

          – W.M.
          Apr 23 at 15:06





          Thanks for the detailed answer. So, you're saying that I should connect (login) to the destination machine (backup server) as root and not as a normal user?

          – W.M.
          Apr 23 at 15:06




          2




          2





          As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

          – HBruijn
          Apr 23 at 15:12





          As a normal user you can't create files that don't belong to you, so you need to either log in as root on the destination, or you have to be root locally and run rsync in the opposite direction and pull the files in.

          – HBruijn
          Apr 23 at 15:12











          2














          With your case specifically, the real issue arises when it comes time to restore the files. The key would be to specify the desired owner/group when you pull the files back. --chown=vmail:vmail



          Assuming that you've already created the user vmail on the new machine to which you will restore, you'd issue something like the following:



          sudo rsync -av --chown=vmail:vmail --force --delete --progress user@my_backup_server:/home/user/backups/vmail/ /vmail/


          Doing it this way means it doesn't matter who owns the files on the backup server so long as you can rsync to/from that user (which is implied as already being true in your example).






          share|improve this answer








          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















          • Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

            – Tonin
            Apr 24 at 18:02






          • 1





            Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

            – HBruijn
            Apr 24 at 21:18
















          2














          With your case specifically, the real issue arises when it comes time to restore the files. The key would be to specify the desired owner/group when you pull the files back. --chown=vmail:vmail



          Assuming that you've already created the user vmail on the new machine to which you will restore, you'd issue something like the following:



          sudo rsync -av --chown=vmail:vmail --force --delete --progress user@my_backup_server:/home/user/backups/vmail/ /vmail/


          Doing it this way means it doesn't matter who owns the files on the backup server so long as you can rsync to/from that user (which is implied as already being true in your example).






          share|improve this answer








          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















          • Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

            – Tonin
            Apr 24 at 18:02






          • 1





            Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

            – HBruijn
            Apr 24 at 21:18














          2












          2








          2







          With your case specifically, the real issue arises when it comes time to restore the files. The key would be to specify the desired owner/group when you pull the files back. --chown=vmail:vmail



          Assuming that you've already created the user vmail on the new machine to which you will restore, you'd issue something like the following:



          sudo rsync -av --chown=vmail:vmail --force --delete --progress user@my_backup_server:/home/user/backups/vmail/ /vmail/


          Doing it this way means it doesn't matter who owns the files on the backup server so long as you can rsync to/from that user (which is implied as already being true in your example).






          share|improve this answer








          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.










          With your case specifically, the real issue arises when it comes time to restore the files. The key would be to specify the desired owner/group when you pull the files back. --chown=vmail:vmail



          Assuming that you've already created the user vmail on the new machine to which you will restore, you'd issue something like the following:



          sudo rsync -av --chown=vmail:vmail --force --delete --progress user@my_backup_server:/home/user/backups/vmail/ /vmail/


          Doing it this way means it doesn't matter who owns the files on the backup server so long as you can rsync to/from that user (which is implied as already being true in your example).







          share|improve this answer








          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered Apr 24 at 17:13









          rarawlsrarawls

          212




          212




          New contributor




          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          rarawls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

            – Tonin
            Apr 24 at 18:02






          • 1





            Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

            – HBruijn
            Apr 24 at 21:18


















          • Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

            – Tonin
            Apr 24 at 18:02






          • 1





            Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

            – HBruijn
            Apr 24 at 21:18

















          Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

          – Tonin
          Apr 24 at 18:02





          Just adding a note that on old versions of rsync the --chown option is not available. This has been added on 3.1.0 in 2013. And yes, MacOS 10.14 still has rsync 2.6.9...

          – Tonin
          Apr 24 at 18:02




          1




          1





          Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

          – HBruijn
          Apr 24 at 21:18






          Actually that won’t be a problem, on the backup destination files won’t be owned by the vmail user, as that user doesn’t exist there, but will have an owner with only numerical UID. When using rsync in the opposite direction, for a restore, rsync will preserve that numerical UID. On the mailserver that UID is assigned to the vmail user and ownership will be restored correctly

          – HBruijn
          Apr 24 at 21:18


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Server Fault!


          • 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%2fserverfault.com%2fquestions%2f964229%2fpreserving-file-and-folder-permissions-with-rsync%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

          Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

          Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

          Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020