New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy script to remote and execute OR create command object from local script #103
Comments
Hi, The other option is to copy the script to the host using another package and then run it with ssh2shell. |
Remember You could try SCP to transfer from local to host while connected. //Just a script
host.commands= ["scp myscript.sh " + host.server.username + "@" + host.server.host + ":/some/remote/directory",
"sudo chmod 700 /some/remote/directory/myscript.sh",
"./some/remote/directory/myscript.sh"]
//a folder
host.commands= ["scp -r scripts " + host.server.username + "@" + host.server.host + ":/some/remote/directory/scripts",
"sudo chmod -R 700 /some/remote/directory/scripts"] Authentication could require handling. |
I apologize for delayed response on this. I was able to do a workaround through this problem which worked for me. echo "<>" | base64 -d | bash and if you have command line inputs: This worked for me without physically copying the script on target as well as running into any special character issues with echo or printf statement. Hopefully it can help others who are looking to solve the same problem. |
Hi there,
First of all thank you so much for creating this library. This is awesome, really easy to use. We are able to use it with minimal efforts. Now we are stumbling upon a use case where we need to execute a script on the remote server which is present at local.
I saw the Bash script on the fly part https://www.npmjs.com/package/ssh2shell#bash-scripts-on-the-fly- and tried to read the file and create the command array on the go but wasn't able to. :(
Is there any way, we can directly copy the file to remote server or command array can take input of local shells script?
Please let me know if any further information is required.
The text was updated successfully, but these errors were encountered: