Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.