SSH and run commands as another user.
I need to SSH into a very locked down server (where I am an operator, not an admin) and run a few commands as another user.

This is what I try to use:
ssh -t myUser@remoteServer 'sudo /var/sudo/theOtherUser; sudo /usr/sbin/application1; sudo /usr/sbin/application2'

It works fine but right after i change user to theOtherUser my "scritp" stops. After I do an exit it resumes and tries to run the two remaining commands as myUser.

Is there any way to run them as theOtherUser? I can't login as theOtherUser in any other way than this and the system is very locked down so I have to do everything by SSH.

Thanks for any help!
SSH and run commands as another user.
===

I need to SSH into a very locked down server (where I am an operator, not an admin) and run a few commands as another user.

This is what I try to use:
ssh -t myUser@remoteServer 'sudo /var/sudo/theOtherUser; sudo /usr/sbin/application1; sudo /usr/sbin/application2'

It works fine but right after i change user to theOtherUser my "scritp" stops. After I do an exit it resumes and tries to run the two remaining commands as myUser.

Is there any way to run them as theOtherUser? I can't login as theOtherUser in any other way than this and the system is very locked down so I have to do everything by SSH.

Thanks for any help!