3

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?

  • 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
  • 1
    Wow... could you get a libtermcap and scp it over? – Paul Nov 16 '11 at 7:46
0

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).

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.