Backup Linux Users, howto?

Rainsford

Lifer
Apr 25, 2001
17,515
0
0
I have a question for all you Linux people out there, is there a way to "copy" Linux system users from one machine to the other? I am going to reinstall Linux on my little server (various reasons) but I don't want to have to re-setup the user accounts and passwords I've given to some people. I've only configured users through linuxconf, so I'm sure there's a file or something, I'm just not sure which one. Any help would be appreciated. Thanks.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
you could copy their info from /etc/passwd and/or /etc/shadow

i'm a little too inexperienced to know what other impacts this might have or what else you need to do....i *think* those are all you need to copy, dont copy the whole file, just the users you want to transfer over....keep in mind you'll have to recreate their home dirs and whatnot...seems to me the easiest way would be to just use useradd/adduser and redo them, unless you have 50 of them or something..
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
If it's just a matter of user accounts and not settings, then you could do just what BBWF suggested and copy /etc/passwd and /etc/shadow into the new system. Maybe /etc/group also, if you use groups to any extent. The only problem I see would be if you're using distros which use different system users (like "daemon" or "news") - you should compare the files beforehand and see if those users will match up. If the system users are different, then you should still be able to append the old "human" user accounts (usually User ID 1000+) onto the end of the new system's passwd and shadow files.
 

Rainsford

Lifer
Apr 25, 2001
17,515
0
0
My only concern about copying /etc/passwd and /etc/shadow is that isn't the password encrypted differently on different computers? If that isn't a problem, those solutions would work fine for me.
 

mcveigh

Diamond Member
Dec 20, 2000
6,457
6
81
I have done that before with out problems. as amoatter of fact I'm going to do it next week , I have a server thats getting 2 new OS hard drives, I'll probably just back up the whole /etc directory and restore it.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0


<< My only concern about copying /etc/passwd and /etc/shadow is that isn't the password encrypted differently on different computers? If that isn't a problem, those solutions would work fine for me. >>



md5 works the same on one machine as it will on another machine. If you arent using atleast md5, you should just redo everything from the ground up.

On OpenBSD, you would have to go through an extra step or two. But there are some fairly easy ways to convert from FreeBSD (I think) to OpenBSD /etc/master.passwd files, so its not a huge deal. I dont think this is as much of a problem on Linux.
 

Rainsford

Lifer
Apr 25, 2001
17,515
0
0
Thanks n0cmonkey, I was hoping you'd lend your expert opinion. The general opinion seems to be that this will work, so I think I'll give it a try. Thanks for all the help everyone.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0


<< Thanks n0cmonkey, I was hoping you'd lend your expert opinion. The general opinion seems to be that this will work, so I think I'll give it a try. Thanks for all the help everyone. >>



Let us know how it goes.