passwd file and user accounts

Eduardo Viruena Silva mrspock at
Sat Jul 7 17:23:28 UTC 2007

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:::

/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


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.


> Thanks,
> Lisa Casey

More information about the freebsd-questions mailing list