SSH connection closes as shell fails to load

freebsdshellsshzsh

I have FreeBSd running with OpenSSH. I set up everything and the connection via SSH worked perfectly. Then I decided to get rid of some not used ports and I obviously uninstalled one that was used by zsh.

When I log in I get the following:

~ # ssh cristian@192.168.1.56
Password:
Last login: Wed Nov  7 21:56:26 2012 from 192.168.1.52
FreeBSD 9.0-RELEASE (GENERIC) #0: Tue Jan  3 07:15:25 UTC 2012

Welcome to FreeBSD!

Before seeking technical support, please use the following resources:

o  Security advisories and updated errata information for all releases are
   at http://www.FreeBSD.org/releases/ - always consult the ERRATA section
   for your release first as it's updated frequently.

o  The Handbook and FAQ documents are at http://www.FreeBSD.org/ and,
   along with the mailing lists, can be searched by going to
   http://www.FreeBSD.org/search/.  If the doc package has been installed
   (or fetched via pkg_add -r lang-freebsd-doc, where lang is the
   2-letter language code, e.g. en), they are also available formatted
   in /usr/local/share/doc/freebsd.

If you still have a question or problem, please take the output of
`uname -a', along with any relevant error messages, and email it
as a question to the questions@FreeBSD.org mailing list.  If you are
unfamiliar with FreeBSD's directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man'.

Edit /etc/motd to change this login announcement.

Shared object "libiconv.so.3" not found, required by "zsh"Connection to 192.168.1.56 closed.

The thing is that I have no monitor nor do I have a keyboard (right now) to solve the problem very quickly…

I tried this to force loading a different shell > Force SSH to use a specific shell

Does not work as I get:

~ # ssh cristian@192.168.1.56 /usr/local/bin/sh << EOF
chsh -s /usr/local/bin/bash
EOF
Password:
Shared object "libiconv.so.3" not found, required by "zsh"%    

Any ideas how to solve it without keyboard and monitor?

Best Answer

I did this same exact error once. I doubt you'll be able to get the root access needed to change your shell remotely. Another, less likely option is to hack your own box and get root privileges.

I had to connect locally via keyboard and monitor and change to the default shell. Never make root use a userland shell. Always let root use the default shell that comes with the system. If you need or want to use a different shell, start it manually after login. This is what I do now.

And remember, don't do make delete-old-libs in /usr/src unless you absolutely know you won't be needing those libs anymore :-D