How to run a script file remotely using SSH

后端 未结 6 1669
无人共我
无人共我 2020-12-07 12:17

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@se         


        
6条回答
  •  有刺的猬
    2020-12-07 13:01

    Backticks will run the command on the local shell and put the results on the command line. What you're saying is 'execute ./test/foo.sh and then pass the output as if I'd typed it on the commandline here'.

    Try the following command, and make sure that thats the path from your home directory on the remote computer to your script.

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

    Also, the script has to be on the remote computer. What this does is essentially log you into the remote computer with the listed command as your shell. You can't run a local script on a remote computer like this (unless theres some fun trick I don't know).

提交回复
热议问题