Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

quick question:

I have a program that is spawning a process which executes a basic remote command over SSH such as:

ssh aiden@host /bin/ps

Running this manually from my shell is successful (as you would expect), but the parent program running the task always exits 127 ... even with absolute paths.

It isn't the local end returning 127 (it can find the ssh binary), but it is always the remote end even when equivalent commands from the shell, with absolute paths also, run fine.

Any ideas why my shell can execute this command, but my program can't? I realize this may be specific to my language (and therefore a question for StackOverflow), but my program passes its environment to SSH so I can't think what differs.

Any ideas?

share|improve this question

Problem solved. The API I was using to spawn the process was incorrectly adding quotes:

On the shell (works fine)

]$ ssh aiden@host /bin/ps

My program was executing the equivalent of:

]$ ssh aiden@host "/bin/ps"

Which was causing issues because IIRC the shell handles quotes, and the shell is obviously missing from the API end.

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.