4

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

3
  • 2
    Maybe try using sftp to overwrite /etc/passwd or /bin/bash? – Kenster Apr 30 '13 at 14:25
  • My Google Fu tells me that this is most likely a borked update. So rerunning the update (if possible, never did BSD) might be a solution...if you can login again, that is. – Bobby Jun 17 '13 at 10:50
  • FreeBSD installs seem to ship with two root accounts. 'root' and 'toor'. By default toor has csh as shell. Logging in as toor and then fixing the other accounts with chsh seems the way to go. – Hennes Apr 14 '17 at 10:59
3

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.

1

ssh will always use the configured shell after logging in and then use that to start the program you requested. What you would need is a different subsystem to start. By default there is ssh and sftp, and you could try and add your own in /etc/ssh/sshd_config:

Subsystem  binsh /bin/sh

(by downloading /etc/ssh/sshd_config using sftp, modifying it, uploading it again, and rebooting the machine somehow) and then select that using

ssh -s -l <account> <machine> binsh

Note: Untested, i.e. if it breaks you get to keep the pieces.

3
  • 1
    According to O'Reilly·, the valid syntax would be: ssh -s binsh <machine> -l <account> – Jaime M. Mar 9 '15 at 14:26
  • nice idea, however ssh -s flag is not available on linux. – w00t Aug 17 '16 at 20:29
  • Actually it is supported, except that it is (in some cases) wrong in the usage line, and the man page. But ssh -s localhost binsh seems to work on Raspbian Jessie. – Coroos Apr 14 '17 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.