[Dirvish] Question about UIDs and GIDs

wes dirvish at the-wes.com
Wed Aug 15 04:29:12 UTC 2012

whoops! forgot the backticks around ls:
for a in `ls`;do chown -R $a:$a $a;done

this happened because I'm still updating my old bad habit of using * here,
which would not have needed the ``.

anyway, I'm sure I've spouted enough nonsense. hoping for the best for you!


On Tue, Aug 14, 2012 at 9:25 PM, wes <dirvish at the-wes.com> wrote:

> hurray! a question I can help with!
> firstly, welcome Joe.
> as you've noticed, the numerical UID and GID is preserved during backup.
> If the restore is done in the same fashion as the backup, the numerical UID
> and GID will also be preserved during restore. It's up to the machine the
> file is being accessed from (as opposed to the machine the file is being
> stored on) to determine what names those numbers correspond to.
> this is a common problem with any backup software. unfortunately, often a
> restore is needed after a total crash of a machine, thus having the name/ID
> matchup either disappear (you DO backup your passwd file, right?) or become
> out of sync or otherwise fubar. If you're backing up the entire system,
> this should not be an issue. If you're only backing up user data, this may
> well be a problem.
> people doing restores often have to go through the process of chown/chmod
> after restoring. when I restore many users' data (ok, I only actually did
> this once) I ran a loop in bash to chown the files to the name of the
> directory under /home. in my case, the directories had the same names as
> the users. I don't recall the exact incantation, and I'm sure I tried
> several times before I got it right. something along the lines of:
> for a in ls;do chown -R $a:$a $a;done
> so for the following contents of /home:
> central joe vince wes
> we should see a loop 4 times of this:
> chown -R central:central central
> chown -R joe:joe joe
> chown -R vince:vince vince
> chown -R wes:wes wes
> obviously, this gets more complicated if you're restoring more than just
> user data, or if your users' primary groups are not their own groups (and
> they are different; if they're the same, just specify that instead of the
> variable).
> hopefully some of this makes sense. please feel free to respond back with
> any further questions you may have :)
> -wes
> On Tue, Aug 14, 2012 at 8:21 PM, Joe Aquilina <joe_linux at westnet.com.au>wrote:
>> Hello all.
>> I am relatively new to Linux and even more so to Dirvish. I have
>> inherited the admin of a system where some of our machines are backed
>> up nightly via dirvish to a central server. The current system has
>> been in place for some years and I am just beginning to learn about
>> how it all works. We haven't yet had to restore anything yet which is
>> good because I am not yet sure of exactly how to do that.
>> Experimenting with that on another computer as I type here...
>> My question relates to UIDs and GIDs of user accounts on the systems
>> being backed up. On these systems, there a number of users, some of
>> which are duplicated across the various machines, usually with
>> different UIDs and/or GIDs on the various machines. These are also
>> different to the IDs used on the corresponding accounts on the backup
>> server.
>> When I look at the backups on the server after they complete, the
>> directories &files have the UIDs and GIDS for the accounts as they
>> exist on the backup server. These correspond to the numeric IDS from
>> the machines that have been backed up.
>> For example, there may be an account called joe, in group joe on a
>> machine to be backed up with a UID of 1002 and a GID of 1003. When
>> the backup completes, and I check it, everything has an owner for
>> example of central and a group of vince. These correspond to accounts
>> on the backup server of central with a UID of 1002 and a GID of 1003.
>> Hope this makes sense.
>> Does this matter? Is there going to be a problem if I restore the
>> files back to the original machine? Will the UID & GID revert back to
>> joe when the restore is done? Do I need to change anything on the
>> system(s) for future backup runs to avoid this?
>> Do you need any more information (e.g. contents of master.conf,
>> default.conf, rsync command for the backup or anything else) to be
>> able to assist with this query?
>> I am hoping I am worrying about nothing but I don't fully understand
>> dirvish yet so am a bit apprehensive about changing anything (and
>> shudder at the thought of possibly having to change all the UIDs and
>> GIDS on the various machines and then changing all the files!) I have
>> other dirvish questions but will follow up with those if I can't work
>> out an answer for myself. Thanks in advance.
>> Joe Aquilina
>> _______________________________________________
>> Dirvish mailing list
>> Dirvish at dirvish.org
>> http://www.dirvish.org/mailman/listinfo/dirvish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dirvish.org/pipermail/dirvish/attachments/20120814/a1364a5f/attachment-0001.html 

More information about the Dirvish mailing list