LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to backup username/password (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-backup-username-password-569318/)

alirezan1 07-14-2007 11:47 AM

How to backup username/password
 
Hello everyone,

I have Mandriva 2007.1 (Spring edition) installed on my desktop. I have four users on that machine right now. I would like to create a backup of all their username/passwords so that when I reinstall the OS, I can restore the users on the system to its original state.

How can I do that?

Thanks

btmiller 07-14-2007 11:55 AM

Backup the /etc/passwd, /etc/shadow, and /etc/group files and restore them when you reinstall the system.

alirezan1 07-14-2007 01:26 PM

Quote:

Originally Posted by btmiller
Backup the /etc/passwd, /etc/shadow, and /etc/group files and restore them when you reinstall the system.

Thanks for the info. I don't have /etc/shadow. What should I do?

Thanks

milindlokde 07-14-2007 02:44 PM

Quote:

Originally Posted by alirezan1
I don't have /etc/shadow.

Your system may not be using the /etc/shadow file.

All user information is stored in /etc/passwd file. It includes the user name, password (encrypted), login shell, home directory, etc.
For security reasons most linux systems store the users passwords in a seperate file - /etc/shadow. In this case you will have to backup both /etc/passwd and /etc/shadow files.

chris_g_g 07-15-2007 08:17 AM

Don't just overwrite the files
 
Yikes!
You should be careful about just copying the passwd, group and shadow files from one install to another.
If you are doing a reinstall to the same version and distro, not such a worry but still not a good habit to get into.

You should open your old files, copy only the lines that relate to your users and paste them to the end of the new files.

The reason is that the system creates its own users and groups for various purposes. These don't always match up between distros or even between different version of the same distro. Blindly replacing the new with the old overwrites all these system accounts as well which can cause unexpected things to happen.


All times are GMT -5. The time now is 01:11 PM.