Freebsd – Changed root’s shell to non-existing path

freebsdrootshell

I just made a bit of a mistake:

  • Fresh install of FreeBSD 8.2
  • logged in as root
  • installed bash from ports
  • created users, setting bash as shell
  • vipw (edit passwd file)
  • changed root's shell from /bin/csh to /bin/bash
  • logged out
  • log in as root
  • WRONG!!

As you probably guessed, bash shell is not placed in /bin 🙁 Pretty dumb mistake!

Now I can't login as root.
I can login as my wheel user, but can't vipw.

Tried the following without luck:

  • Reboot to single user, /rescue/vi /etc/passwd
  • Login as wheel user, su -m

So how do i change the root shell back to /bin/csh ?

I could just re-install – but i'd rather learn some new stuff!

Best Answer

Boot into single user mode and then:

mount -w /
vipw

Change path to /usr/local/bin/bash

exit
Related Topic