Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to log through SSH as user@remote and then change the user to tomcat, move files to $CATALINA_HOME/webapps and re-start the tomcat server in the same script.

share|improve this question
ssh user@remote sudo -i -u tomcat ...
share|improve this answer
for > 1 command, replace ... with sh -c 'multiple; commands; here' – glenn jackman Apr 5 '11 at 2:04
When I use ssh user@remote sudo -i -u tomcat, I get sudo: Illegal option -i – davidhalldor Apr 5 '11 at 11:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.