HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free and registered users see less advertising! If you just want to browse through the existing questions, just select the forum that you want to visit from the selection below. Otherwise, click here to register!. We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Backing up user accounts

I have a box I need to rebuild. If I want to move existing users from this box to the new one, can I simply backup up their /home directories, /etc/passwd and shadow password and move them to the new box? I realize permissions will have to be reset on the home directories, but is there anything else that needs to be done? Is this even possible? Am I missing something? Can it be that simple?

Re: Backing up user accounts

it can be done this way .. I have my /home on a separate partition , so when I needed to reinstall my distro I just formatted the other partitions and remounted the /home under /home ... then I recreated my username and set the permissions of the home dir.
You can copy the passwd and shadow files but it isnt needed you could also
just readd the user with useradd

Re: Backing up user accounts

You can copy the passwd and shadow files but it isnt needed you could also
just readd the user with useradd

Thanks for the tip on the /home partition. I did not think of that one.

However, I'd rather not readd my users as there are about 450 of them. Which shadow files will I need to move in order for the passwords to remain the same after the reinstall? I noticed there is a shadow as well as a shadow-. Are there any other files associated with these?

Re: Backing up user accounts

Don't forget about /var/mail. Each file with proper permissions (tar can do that for you).

Do you use samba ? Remember smbpasswd.

There are actually a large number of directories that I'm going to tar before I re-install, var/spool/mail and /var/www/html being among them. Tar will perserve permissions? Winduhs creates a unique SID for each user account, does *nix do anything like this, or is everything maintained in passwd and shadow?

Re: Backing up user accounts

One note, if you backup passwd, group, and shadow, you will not need to change ownership of files. Tar is capable of preserving ownership of files. There's a certain switch though and you'll need to read the man page to figure out what. (I think it's -k.) Tar remembers what user id number owned the file, but if you backup passwd, group, and shadow, all the users will still have the same uid. Otherwise you'd have to recreate the users and they could have different uid's, messing up ownership. When gonzojohn posts my tutorial at LinuxOrbit on backing up your hard drive to cd's, you could look at it for a good reference. (And I mean very good. [smiles])