NOTE: The servers does not share the same password but I will setup no-password login at first.
Here's the use case, I need to do these below step by step in my
- scp files to remote servers'
/opt/bindirectory, which requires root permission
- After that, ssh into remote servers and run
sudo install.sh, which also requires root permission
- Login as root is not allowed by servers
I noticed there's way to
ssh and run sudo command but it seems not work for
It really bothered me a lot ...
BTW: I think one of the possible way is that scp files to a normal directory and then ssh and run
sudo mv * /opt/bin; sudo install.sh.