Ssh & sudo

when the following command is issued the command prompt is received, how do I get past this?

ssh -t usera@hosta sudo su - userb -c  id

Unless you are root on the remote server, su will ask for a password. So I don't quite get what you are seeing.

Try this:

ssh -t usera@hosta sudo 'su - userb -c id'
1 Like

I still get the password prompt,

Thats exactly what Jim said in post #2
I understand you ar not root then... You will have to see with your admins if then can correct the sudoers files for your requirement...

1 Like

If you have sudo rights with the NOPASSWD option set, then you will not be prompted. An example line from out file reads:-

SECADMIN ALL= NOPASSWD: /usr/bin/mkdir

There may be some resistance to this option though as it means there is no challenge to the command for that user/group.

I hope that this helps,
Robin
Liverpool/Blackburn
UK