Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.