[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Restore passwords from backup in new install



On 14:49 07 Nov 2003, Bob McClure Jr <robertmcclure earthlink net> wrote:
| Here's a possible howsomever.  The system "users", e.g. mail, ftp,
| apache, mysql, may be different from one distro to another, so perhaps
| you should save and restore passwd and shadow entries over UID >= 500
| and group entries >= 100.
| 
| I say that because I once transferred passwd, shadow, and group files
| to a new system, and one of the daemons quit working because his UID
| didn't exist anymore.

If you just want the passwords you can yank them and the matching
login/group names with awk. Then patch them in on the new system. This,
by caring only about logins, will leave the new system's uids alone.

Eg for /etc/shadow:

	awk -F: '{print $1":"$2}' /etc/shadow

Then remerge on the new system, either by hand or with a script.
Here's a simple hack to patch the passwd field for me to "xxx":

	awk -F: 'BEGIN			{ OFS=":"}
		 $1 == "cameron"	{ $2="xxx" }
			  		{ print }' /etc/shadow

which could be beefed up to load a bunch of passwords and apply them.

Obviously some work's involved, but it may pay off.

Cheers,
-- 
Cameron Simpson <cs zip com au> DoD#743
http://www.cskk.ezoshosting.com/cs/

A good newspaper is never good enough, but a lousy newspaper is a joy
forever.        - Garrison Keillor




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]