I run
ssh root@myhost "sh -x" < myremotecommands.sh
where myremotecommands.sh contains:
#!/bin/sh
sudo su
apt-get update
sudo su -l -p jenkins
whoami
however the command whoami returns 'root'. I need to be user jenkins to perform some installations.
How can I switch to the user jenkins in the middle of the script ?