If I ssh into an osx box from a linux box, issuing socat works fine. However, if I give the socat command as argument to ssh it fails. socat was installed in osx using brew. Any idea why this is happening?

This works:
  $ ssh daniel@remoteOSX
  $ socat -d -d SYSTEM:date -
  < date shows up here :) >

This fails:
  $ ssh daniel@remoteOSX 'socat -d -d SYSTEM:date -'
  bash: socat: command not found                                <-- The ERROR

Clearly, plain ssh does not use your PATH. Recreate your environment by spawning a login shell.

ssh daniel@remoteOSX 'bash -lc "socat -d -d SYSTEM:date -"'

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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