Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2007 12:15:40 -0500 (CDT)
From:      Eduardo Viruena Silva <mrspock@esfm.ipn.mx>
To:        Lisa Casey <lisa@jellico.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: passwd file and user accounts
Message-ID:  <20070707114332.O40553@Gina.esfm.ipn.mx>
In-Reply-To: <003701c7c0ac$f7a6f350$d5b9bfcf@lisac>
References:  <003701c7c0ac$f7a6f350$d5b9bfcf@lisac>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 7 Jul 2007, Lisa Casey wrote:

> Hi,
>
> This is probably a stupid question, but I'll ask it anyway...
>
> I have a Red Hat Linux system I need to get rid of. It is currently doing 
> e-mail for approximately 700 users and is also doing radius authentication. I 
> have setup a new FreeBSD computer to take it's place. I have everything setup 
> now on the FreeBSD computer except for the user accounts and mailboxes. The 
> mailboxes aren't a problem, I've used tar to move mailboxes before.
>
> I suppose I cannot simply copy /etc/passwd, /etc/group and /home from the 
> Redhat computer to the FreeBSD computer due to the password hash in 
> /etc/passwd. Am I correct on this?  Would it be possible to copy /etc/passwd 
> then (before the new system goes "live") reset all the passwords with the 
> passwd command? That might be easier than adding in close to 700 accounts 
> using adduser.  Does anyone  have a better idea of how I might go about doing 
> this?

Yes, you are right, you cannot simply copy the password files.

FreeBSD and RedHat passwords files have different formats,
and they also have different User IDs for the system users.

Your real problem is to merge RedHat's "/etc/passwd" and "/etc/shadow"
in order to create your /etc/master.passwd in FreeBSD and then
you have to create your hash db from this file.

In RedHat for instance, you have:

/etc/passwd:  daemon:x:2:2:daemon:/sbin:/sbin/nologin
/etc/shadow:  daemon:*:11688:0:99999:7:::

Meaning:
/etc/passwd:  UserName:x:UserID:GroupID:RealName:HomeDir:Shell
/etc/shadow:  UserName:CryptedPassword:...

In FreeBSD's master.passwd, you have:

daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin

UserName:CryptedPassword:UserId:GroupId:UserName:LogClass:0:0:RealName:HomeDir:Shell

As you can see, "daemon" has different UIDs.

I believe RedHat also uses MD5 for coding passwords but I do not know it
for sure.  So, take ONLY the entries of YOUR USERS and merge them in the
FreeBSD's format and leave the list in a file.

Once you have done this, use 'vipw' to edit your master.passwd, include 
your file of your users, and save it.  This program will create your hash
table and will update the password files.

Good luck.

       Eduardo



>
> Thanks,
>
> Lisa Casey
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070707114332.O40553>