[NTLUG:Discuss] MAJOR mess
Steve Baker
sjbaker1 at airmail.net
Sat Oct 27 14:59:33 CDT 2001
R P Herrold wrote:
>
> On Sat, 27 Oct 2001, Jim Wildman wrote:
>
> > Oh sure you're _supposed_ to....but real geeks edit passwd with
> > echo "newuser::..." >> /etc/passwd. They don't even bother with vi!
I did do something like that once. (I used:
# cat <<HERE >>/etc/passwd
? newuser::...
? HERE
It was on a Z8000-based machine from ONYX computing that didn't have a
working 'vi'. Faced with the alternatives, I chose 'cat' rather than
using 'ed'. There are times when even a real geek knows when to back
down!
> ... ohhh ... we geeks could accidentally make that root userid
> deletion too -- my fingers might slip and type:
>
> grep -v ^root: /etc/passwd > /etc/pwtemp ; mv /etc/pwtemp \
> /etc/passwd
>
> and I'd be in the same mess ... (more ...)
You'd probably have bad permission bits on /etc/passwd too.
> MUCH worse would be:
>
> grep -v ^root: /etc/passwd > /etc/passwd
>
> Anyone want to comment why <grin>?
That's *too* easy!
Because that completely erases *all* the passwords.
When you first hit return, the shell sees that you want to create the file
/etc/password and hence opens it for writing. That creates a zero length
file. Then the shell starts grep which is now grepping an empty file.
--
NOTE: MY HOME PAGE HAS MOVED TO http://www.sjbaker.org - PLEASE
UPDATE YOUR LINKS AND BOOKMARKS ACCORDINGLY!
----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1 at airmail.net> WorkMail: <sjbaker at link.com>
URLs : http://www.sjbaker.org
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://prettypoly.sf.net http://freeglut.sf.net
http://toobular.sf.net http://lodestone.sf.net
More information about the Discuss
mailing list