From owner-freebsd-stable Fri Dec 6 15:10:36 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5764137B401 for ; Fri, 6 Dec 2002 15:10:35 -0800 (PST) Received: from mail.sandvine.com (sandvine.com [199.243.201.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id D03C043EBE for ; Fri, 6 Dec 2002 15:10:34 -0800 (PST) (envelope-from don@sandvine.com) Received: by mail.sandvine.com with Internet Mail Service (5.5.2653.19) id ; Fri, 6 Dec 2002 18:10:21 -0500 Message-ID: From: Don Bowman To: "'freebsd-stable@freebsd.org'" Subject: pw useradd not atomic? Date: Fri, 6 Dec 2002 18:10:20 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In a test-lab environment, I'm forging users on a machine based on their home directory name/permissions: for i in /phaedrus/home/* do if [ -d $i ] then id=$(ls -lnd $i | awk '{print $3}') gid=$(ls -lnd $i | awk '{print $4}') uid=$(basename $i) id $id 2>/dev/null 1>/dev/null if [ $? -eq 1 ] then pw useradd $uid -u $id -s /bin/bash ln -s $i /home fi fi done This is done the first time the machine is imaged. I don't want to run NIS or any other directory service. I use ssh for access with just dsa keys so I'm not worried about actual passwords for these accounts, just to make them exist. The groups file starts out normal: wheel:*:0:root daemon:*:1:daemon kmem:*:2:root ... Sometimes after this script been run I end up with only the last few lines of the groups file. Is 'pw' not atomic somehow? The lines that are there seem complete, i'm just missing the first 100 lines or so. Its not always the same amount missing. --don (don@sandvine.com www.sandvine.com) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message