socat as argument to ssh: "bash: socat: command not found"

0

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 -'
  Password:
  bash: socat: command not found                                <-- The ERROR

Daniel

Posted 2014-10-03T10:22:19.673

Reputation: 373

Answers

1

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 -"'

glenn jackman

Posted 2014-10-03T10:22:19.673

Reputation: 18 546