nam
nam

Reputation: 3632

How to execute bash with ssh connection

I'm trying to write a bash script to automatically do stuff in clients machines in the network. But after the code

ssh -i ~/.ssh/key root@machine

The bash program just stops What can I do to send the command to the remote machine? Thanks

Upvotes: 0

Views: 166

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798566

Same way as if you were invoking bash directly.

ssh ... somescriptontheserver.sh

ssh ... ls -lR /

ssh ... << EOF
ls -lR /
EOF

Upvotes: 3

Related Questions