I am trying to run a script which executes a chain of commands under another user on a remote server. The script contains the following ssh command to return information about the remote user's Drupal installation. My sudoers user's public key is in place and working properly.
The following example does not work and just stops without any output:
$ssh email@example.com "sudo -u another_user -s;cd ~/htdocs;drush status;"
When I enter the chained commands manually in the console it works fine.
I do also get good results with:
$ssh firstname.lastname@example.org "ls -al /var/www/vhosts/"
Please advise where I go wrong. Thank you.