bad root shell

Mark McConnell markmc at
Sat Dec 20 11:31:19 PST 2003

An error in a pw* script inserted a non-existent shell into the 
password database, effectively locking out root.

I used a fixit disk to correct the problem, using this procedure:

1. mount boot drive to /mnt

2. provide myself with a working mkdb and vi (for chpass):
# mkdir /usr/sbin /usr/bin
# ln -s /mnt/usr/sbin/pwd_mkdb /usr/sbin/pwd_mkdb
# ln -s /mnt/usr/bin/vi /usr/bin/vi

3. link pwd.db, spwd.db, group, passwd, master.passwd, ex:
# rm /etc/group /etc/spwd.db
# for i in `ls /mnt/etc/` ; do ln -s /mnt/etc/$i /etc/$i ; done

4. run mkdb
# /usr/sbin/pwd_mkdb master.passwd

5. Using chpass to change root's shell from `badshell' to csh
# chpass root

All of this appears to do work without errors:
# pw usershow -u root
root:*:0:0::0:0:Charlie &:/root:/bin/csh

However, when I log in as root, I am still locked out with the 
$ su
Password: ********
badshell:  No such file or directory

I am still stupid.  I am still locked out.  /etc/passwd and 
/etc/master.passwd no longer show the badshell.  My configuration 
appears to be deeply broken.  Why does my procedure fail?  

Mark McConnell - Portland, OR
Technical Imaging Systems
markmc at
mkmcconn at

More information about the freebsd-questions mailing list