Security Basics mailing list archives

Re: Root account desactivated


From: Patrice Neff <mailinglists () patrice ch>
Date: Sat, 13 Mar 2004 17:32:41 +0900

sil <jesus () resurrected us> writes:

sudo sed 's/\/sbin/\/nologin/\/bin\/bash/g' /etc/passwd >> /tmp/passwd|\
mv /tmp/passwd /etc/passwd

This will in fact now work. First the sed script contains a small
mistake. But more important, only the call of sed is executed as root,
everything else (including the redirect into /tmp/passwd) is executed
as a non-privileged user. If you actually choose this approach, you
only have to sudo the mv statement.

This is what your statement gives me on my machine:
$ sudo sed 's/\/sbin\/nologin/\/bin\/bash/g' /etc/passwd >> /tmp/passwd;\
mv /tmp/passwd /etc/passwd
mv: overwrite `/etc/passwd', overriding mode 0644? y
mv: cannot move `/tmp/passwd' to `/etc/passwd': Permission denied
$ 

Regards
Patrice

-- 
Jesus answered, "I am the way and the truth and the life. No one comes
to the Father except through me."               (The Bible, John 14:6)

---------------------------------------------------------------------------
Ethical Hacking at the InfoSec Institute. Mention this ad and get $545 off 
any course! All of our class sizes are guaranteed to be 10 students or less 
to facilitate one-on-one interaction with one of our expert instructors. 
Attend a course taught by an expert instructor with years of in-the-field 
pen testing experience in our state of the art hacking lab. Master the skills 
of an Ethical Hacker to better assess the security of your organization. 
Visit us at: 
http://www.infosecinstitute.com/courses/ethical_hacking_training.html
----------------------------------------------------------------------------


Current thread: