How to run a script file remotely using SSH

Progress Programmer picture Progress Programmer · Jun 25, 2009 · Viewed 161.1k times · Source

I want to run a script remotely. But the system doesn't recognize the path. It complains that "no such file or directory". Am I using it right?

ssh kev@server1 `./test/foo.sh`

Answer

German Attanasio picture German Attanasio · Nov 8, 2011

You can do:

ssh user@host 'bash -s' < /path/script.sh