From owner-freebsd-questions Sat Nov 9 18:23:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D4FA37B401 for ; Sat, 9 Nov 2002 18:23:24 -0800 (PST) Received: from mta6.snfc21.pbi.net (mta6.snfc21.pbi.net [206.13.28.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5604143E3B for ; Sat, 9 Nov 2002 18:23:24 -0800 (PST) (envelope-from mbsd@pacbell.net) Received: from atlas ([64.168.24.85]) by mta6.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0H5C00LCI9AYVO@mta6.snfc21.pbi.net> for freebsd-questions@FreeBSD.ORG; Sat, 09 Nov 2002 18:23:23 -0800 (PST) Date: Sat, 09 Nov 2002 18:23:22 -0800 (PST) From: =?ISO-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= Subject: Re: REASON #7919 NOT to do things as root! In-reply-to: <200211091725.54547.joe@dubium.com> X-X-Sender: mikko@atlas.home To: joe Cc: FreeBSD Questions Message-id: <20021109181537.X321-100000@atlas.home> MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Content-transfer-encoding: 7BIT 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 On Sat, 9 Nov 2002, joe wrote: > While playing around and trying to set aup a chroot environment > I did the following > cd /home/honza > mkdir {etc,dev,lib,bin,.....} > > cat /etc/passwd | grep honza >/etc/passwd > ^<== location of the > typing oops > The leading "/" was unintended. > > Aaaaaaaaaaaaahhhhh Been there, done that. I once had an uninstall script running as root with the following line: rm -rf $TOPDRI/* # Yup, should have been "TOPDIR" The result was something like "My mind is going, Dave..." > Now that everyone has gotten back off their seats from the laughter, on > a more serious note is there anything I can do. Let's pretend I don't > have a backup. ..... ok, now that you've stopped laughing again .... > > Is there anything I can do to recover /etc/passwd If you haven't fatfingered your master.passwd too, just do: # pwd_mkdb -p /etc/master.passwd Otherwise, if the box has been up for a while, there should be a backup file, so: # cp /var/backups/master.passwd.bak /etc/master.passwd # pwd_mkdb -p /etc/master.passwd > I just double checked and still seem to have access using other accounts > and I've made a copy of master.passwd in case I "commit" the changes > from passwd. Data is copied in the other direction. There is a reason the file is called "master".passwd... $.02, /Mikko To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message