From owner-freebsd-questions Wed Aug 15 0:55:54 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.freebsd-corp-net-guide.com (mail.freebsd-corp-net-guide.com [206.29.169.15]) by hub.freebsd.org (Postfix) with ESMTP id 48AA737B406 for ; Wed, 15 Aug 2001 00:55:47 -0700 (PDT) (envelope-from tedm@toybox.placo.com) Received: from tedm.placo.com (nat-rtr.freebsd-corp-net-guide.com [206.29.168.154]) by mail.freebsd-corp-net-guide.com (8.11.1/8.11.1) with SMTP id f7F7sSb32617; Wed, 15 Aug 2001 00:54:28 -0700 (PDT) (envelope-from tedm@toybox.placo.com) From: "Ted Mittelstaedt" To: "David Nickel" , Subject: RE: Moving passwds for Sun to FreeBSD Date: Wed, 15 Aug 2001 00:54:27 -0700 Message-ID: <000001c1255f$81ee8d60$1401a8c0@tedm.placo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <20010814202352.21839.qmail@linuxmail.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In order to migrate the Solaris password file to the FreeBSD system, the first step is recombining the two passwd and shadow files. For starters it's critical that the two Solaris password files, passwd and shadow, are synchronized. Solaris password tools do NOT check the password files consistency! vipw is the biggest offender, but there's others. You can get a Solaris box where the first 300-500 lines between the regular and the shadow file are in phase, then there was a missing entry from the shadow and for a couple hundred more lines they were out of phase, then there were 2 missing entries from the regular and they were out of phase the other direction, etc. Solaris will never notice and neither will you as long as both files have the same number of lines. There's various ways to check this - one way is to sort both the shadow and passwd files, then select some random line #'s in the files and make sure they are the same username. Another way is to do the merge and then run a comparison of the merged result against both the shadow and passwd files one after another using the -a output to join, see the man page. To crunch the two together you can use the following perl script that was posted a few years back on Usenet: #!/usr/bin/perl open (SHADOW, "/etc/shadow") || die "Can't open /etc/shadow ($!)\n"; while ($line = ) { ($user, $password, $junk) = split (/:/, $line); $password{$user} = $password; } close SHADOW; open (PASSWD, "/etc/passwd") || die "Can't open /etc/passwd ($!)\n"; while ($line = ) { ($user, $password, @remainder) = split (/:/, $line); if ($password eq "x") { if ($password{$user}) { $password = $password{$user}; } else { warn "Can't find shadow password for '$user'!\n"; } } print join (":", $user, $password, @remainder); } close PASSWD; The next thing needed is to replace all of the commas with colons, and add the additional colon fields that are present in FreeBSD. This can be done with the following command: awk -F, '{print $1":"$2":"$3":"$4"::0:0:"$5":"$6":"$7}' master or awk 'BEGIN {FS=","; OFS=":"} {print $1,$2,$3,$4,"",0,0,$5,$6,$7}' master When this is completed open up the master file and verify that it’s lines looks like the following: . . hmfolk:PcjTEFdWeAxr6:513:60001::0:0:The Realtor:/home/hmfolk:/bin/sh sjccstw:MCJBR96eZWsHM:519:60001::0:0:SJCC:/home/sjccstw:/bin/sh . . Make sure to go through the entire password file and correct any syntax errors. When the password file has been verified to be correct in the editor, run the vipw command and Read ( with vi, do a :r filename) in the new password file. Delete any redundant usernames, and write it out and exit vipw. The FreeBSD hashed password files will be properly rebuilt. Also note that by default as passwords are changed they will be changed to DES ones. You can stop this by changing a setting in login.conf (I'll let you read the man page to find out what that is) Ted Mittelstaedt tedm@toybox.placo.com Author of: The FreeBSD Corporate Networker's Guide Book website: http://www.freebsd-corp-net-guide.com >-----Original Message----- >From: owner-freebsd-questions@FreeBSD.ORG >[mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of David Nickel >Sent: Tuesday, August 14, 2001 1:24 PM >To: freebsd-questions@FreeBSD.ORG >Subject: Moving passwds for Sun to FreeBSD > > >I am in the process of moving users from a SunOS 5.7 Ultra 1 server >to a 4.2 FreeBSD server. There are over a thousand users so I am >looking for a good way to import the users passwds. I have bin >looking at rebuilding the passwd database with pwd_mkdb command. But >there are some differences in the Sun files (passwd and shadow) and >FreeBSD(passwd and master.passwd). If any body can offer advice it >would be much appreciated. >Thanks > >-- > >Get your free email from www.linuxmail.org > > >Powered by Outblaze > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message