Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Permission issue after system restore

On Sun, Nov 28, 2010 at 11:48:22AM +0000, Jens Rehsack wrote:
 > >How did you backup and restore the files?  If using pax, tar or rsync
 > >there are options to preserve file modes/permission bits, ownership etc.
 > >For instance, tar when creating an archive will store that information
 > >by default, but at extraction the -p flag must be supplied to apply
 > >archive-stored permissions to the extracted files.
 > I used a simple "tar xf /path/to/backup.tar" - no special options.
 > Good to know that I managed into it by not preparing myself good enough.
 > [...]
 > >The mtree files are indeed also supposed to hold the default file
 > >permissions, and I think that it can run through files and restore
 > >permissions, however I have no experience with it personally.
 > Do I have to look for something special? I don't want to run in a
 > complete unusable system because I made a second fault.

The easiest fix is to untar the backup again and this time use the -p
flag. If this won't destroy anything (e.g. things you've changed since
you did it the first time), just do that.

Another approach is to do find -ls in the filesystem and tar -xvf on
the backup, postprocess and sort the output suitably, then run diff to
see what's different. Then from the diff you can extract a list of
chowns/chgrps and then chmods to do. This is somewhat of a pain,
although it's fairly straightforward shell scripting, but it's
probably what I'd do in this situation to make sure nothing got

Running mtree is probably easier and probably adequate as long as you
don't e.g. have stuff in /usr/local that got affected. But I too don't
know how to drive mtree :-/

David A. Holland

Home | Main Index | Thread Index | Old Index