How do I migrate users to new Fedora installation?

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sat Sep 22 17:56:28 UTC 2007


Craig White wrote:

> always risky to edit /etc/passwd /etc/shadow & /etc/group manually.
> 
> make backup copies first
> 
> be certain to add the exact matching lines from /etc/passwd
> & /etc/shadow from the old versions to the new.
> 
> I feel the obligation to add that if you were using LDAP for backend
> authentication, this would be a much simpler process.
> 
> Craig
> 
Making backups is always good advice. It is also a good idea to use
vipw and vigr to edit them. If you do not like using vi, you can set
EDITOR to your preferred editor first. The reason to use vipw
instead of using the editor directly is that it sets the locks so
you only have one program changing the file at a time.

Thinking about it, it might be as easy to create a script that grabs
the user name and password out of the passwd and shadow files, and
feed it to useradd or adduser if they are only mail accounts. If the
UID changes, it should not be a problem if you are using tar or
rsync to move the mail files. (You need the correct options, and you
have to run as root.) They can match on user name instead of UID.

If you need to preserve the UID and GID, you can grab that
information also, and feed it to useradd. But if you do not to do
it, this gives you a chance to "defragment" the UIDs and GIDs.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070922/abea012d/attachment-0001.sig>


More information about the fedora-list mailing list