Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to get sshd to run an executable without first starting a shell?

The problem is that I accidentally moved libtermcap on a server (which is running CentOS 5). I can't ssh to the machine as bash needs libtermcap. I can't run a command remotely as sshd uses the shell to parse the command. Is there any way round this or do I have to get the server people to boot into recovery and move it back?

share|improve this question
ForceCommand in sshd_config is also executed using the user's login shell, so that's not an option. – Daniel Beck Nov 16 '11 at 7:43
Wow... could you get a libtermcap and scp it over? – Paul Nov 16 '11 at 7:46

I don't know about CentOS, but a lot of unix-like systems have a statically linked shell at /bin/sh so you could try ssh username@hostname /bin/sh command-to-move-backlibtermcap which will exec the executable at /bin/sh with the command rather than attempt to load a login shell (which as you have pointed out will fail when the login shell depends on libtermcap).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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