0

Currently I am logged in unix server using userid "bob". But i want to sudo as different user(masteruser) inside a script.

My current code is

echo password | sudo -S masteruser bash

In above line password is my password and masteruser is the user which i want to connect. But executing that line i am getting error "sudo: masteruser : command not found"

Can you please help me out for the same.

4

1 回答 1

0
echo password | su masteruser -c "echo this is the command you wish to run as masteruser"
于 2013-06-28T00:04:08.447 回答