Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
BASH: Deploy and execute script on remote Linux node
# Copy to remote node
echo y | pscp -pw "${PASSWORD}" /path/to/ <user>@"$node":/tmp/
# Move to required / accessible directory
echo y | plink -ssh -pw "${PASSWORD}" -t <user>@"$node" "sudo cp /tmp/ /required/path/"
# Convert to Linux BASH (if file edited in Windows)
plink -ssh -pw "${PASSWORD}" -t <user>@"$node" "sed -i 's/\r$//' /required/path/"
# Sudo execute
echo y | plink -ssh -pw "${PASSWORD}" -t <user>@"$node" "sudo bash /required/path/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment