Can anyone help me to to solve following issue
i need to ssh to another server by e.g. ubuntu
user which has permission to run sudo su fore sure then execute pm2 restart command
full command look like this
#!/bin/sh
CMD="sudo su; pm2 restart 0; pm2 restart 1; exit;"
ssh -i somepemfile.pem [email protected] $CMD
for example i can run normally any command with sudo
CMD="sudo /etc/init.d/apache2 restart"
but with sudo su
case it somehow hang and do not response
su
is passwordless butsu -c
is not. – Radley