Log in with different shell when original shell is “broken”

freebsdshellssh

I managed to do something catastrophically stupid and below rookie level.

Clean install on my FreeBSD VPS, then upgraded to version 9.1 (from 9). For some unusual reason, rather than installing screen first, I installed bash through pkg.

Then I changed the shell for both my user AND root. Now when I tried to log back in, on both accounts, and they are the only two accounts, I get a strange error that my google-fu has not been able to procure an answer. I get "/usr/local/bin/bash: Undefined symbol "_ThreadRuneLocale"% " after typing in the password and the. I get booted off the server. I tried doing the same through the console.

Now that I've managed to lock myself out of my account as well as root, genius that I am, I'm wondering if there's a way to login with a different shell but bypassing this problem.

When I try ssh @ -i /bin/sh .. still no go, it gives me the exact same error.

TIA

Best Answer

Is this a full virtual machine, or a FreeBSD jail VPS? If the former, does your provider offer OOB access to the VM's console? If so, reboot the server into single user which uses /bin/sh by default, and from there you can set your root shell back to /bin/csh using chsh or vipw as you prefer.

If your VPS is a FreeBSD jail, or you don't have OOB console access, you'll need to get in touch with your provider's support team and ask them to set your root user's shell back to /bin/csh. They should be able to do this for you with minimal fuss.

If you really want to use bash as your root shell, use the toor user instead or root - it's provided for just such purposes, so you can set up a comfortable environment without the risk of locking yourself out. However, I prefer to leave root exactly as is, as a reminder that I am operating with elevated privileges.

Related Question