0

I have a JavaScript file that I want to run on a remote server. I dont have access to move the script to the server so I want to be able to run the script from my local machine with a remote side argument (filename). Essentially its a script that takes in a file name as an argument and then searches the file that's on the remote server. I tried the following but I get an error code 1. Will i need to write a bash script instead?

ssh name@remote.server 'node filename' < script.js

Here is an image of the script on my local machine and the text on the remote server

Freakup2
  • 3
  • 3
  • If you have ssh access to the remote server it usually means you also have access to scp your script to the remote server. Are you sure you don't have scp or sftp access? – slebetman Jul 14 '20 at 13:52
  • @slebetman I do have sftp access, but im not allowed to move my script to the server for admin reasons. I was thinking I could still run the script from a local machine and get the results i want. – Freakup2 Jul 14 '20 at 13:54
  • I don't know if it would work, but you could try to `cat` the script to `node` like [this answer](https://stackoverflow.com/a/41992516/215552)... Honestly, this is less a JavaScript question than it is an ssh or bash question. – Heretic Monkey Jul 14 '20 at 14:00
  • @slebetman yeah I tired the cat method, doesnt seem to work either. I agree its more a bash question than a JS. Thanks for the help though. – Freakup2 Jul 14 '20 at 14:32

0 Answers0