[K12OSN] backing up user prefs & docs

"Terrell Prudé, Jr." microman at cmosnetworks.com
Thu Oct 21 11:41:13 UTC 2004

Debbie Schiel wrote:

> Hi all,
> This is probably a simple task but I don't know how to do it.
> I just want to make a backup of a user's files & prefs & settings, eg: 
> 'guest'
> I copied the /home/guest folder as root (so included hidden files).
> Then I created user 'guest' with same user ID & password on another 
> machine and replaced the /home/guest folder with the one I had just 
> copied.
> Resulted in errors when I tried to log in as guest.
> If this is the way one is supposed to do it (i.e. just a straight copy 
> of /home/user) then I can work on the errors and try fix whatever I've 
> done wrong. But is there a "proper" way of backing up user prefs & docs?
> Thanks,
> Debbie

You want to throw a few more switches, like so:

  cp -rp /home/guest /my/backup/place

The "r" does a recursive copy, and the "p" preserves permissions, file 
creation/modification times, etc.

One other tidbit:  since this is GNU/Linux that we're talking about 
here, you can also add the "v" ("verbose") switch so that you can see 
each file as it's copied; I always do this whenever possible.  Thus, the 
command I use in actual practice is as follows:

  cp -rpv /source/tree /my/backup/place

Note that the -v switch is one of the famous GNU extensions to the 
original UNIX command set, i. e. it's not supported on "stock" HP-UX, 
OpenBSD, and a few others, unless you install the GNU versions on those 
operating systems.  I always do this at the earliest opportunity.


Do you GNU!? <http://www.gnu.org>
Be virus- and spam-free with Free/Open Source Software (FOSS). Check it 
out! <http://www.mozilla.org/thunderbird>

More information about the K12OSN mailing list