How to access FreeBSD when I can't log in

Hello,

I followed a stupid tip I found to make bash default shell.
I typed this as root:
chsh -s /usr/local/bin/bash

Now I can't login.
When I come to the login and type "root" I get an error
Code:
/usr/local/bin/bash: No Such file or directory.
I read that I have to edit /etc/passwd.

Can I access the file system from the CD?

Fred
 
I guess the solution to this problem must have been rehashed numerous times both in this forum and others.
Basically you have to boot to single-user mode, mount your partitions (mount -atufs) and run vipw to reset your shell to something sensible (in every meaning of the word).
 
fred6633 said:
I followed a stupid tip I found to make bash default shell.
I typed this as root:
>chsh -s /usr/local/bin/bash

Now I can't login.
I bet you found it on linux forums :e

fred6633 said:
Can I access the file system from the CD?
Yes and after edit you will must run pwd_mkdb with -d key to remake password databases
 
Or, just run chsh again, pointing it at the correct shell. No need to muck around with /etc/passwd, pwd_mkdb, vipw, etc.
 
On live cd he will change shell in memory image xD

Btw i assume this tool little buggy, cus of (documented)ignoring /etc/shells and not checking binary exists at all..


upd: fred6633, you can try login as other user, then `su -m`, then chsh (this will not work in some cases)
 
Alt said:
On live cd he will change shell in memory image xD

He can boot into live CD, mount his on-disk installation, and then chroot into it: [cmd=]chroot /where/you/mounted/your/root /bin/sh[/cmd]. Then just run chsh, set the shell to something sensible, umount the disk and reboot.
 
No need to muck about with boot or live CDs. Just boot to single user mode. Hit enter when asked to run /bin/sh. Then do the following:

Code:
fsck -y
mount -u /
mount -a -t ufs
swapon -a

Now change the root shell back to csh:
# chsh -s /bin/csh

Do NOT change root's shell again!
 
Alt said:
Btw i assume this tool little buggy, cus of (documented)ignoring /etc/shells and not checking binary exists at all..

Chsh and other similar utilities have to able to change the user's shell to nonexistent files as well.
 
Back
Top