Hi Folks,
I have to run a shells script (sh) as another user (different from logged user) using an apple script.
I have tu user on my Mac: Peter (administrator) e Bob (standard)
I am logged on my Mac as “Peter” but I have to run a shell script as Bob.
I follow the reference guide and I try the command:
do shell script “script.sh” user name "Bob password “Bob” with administrator privileges
but it fails!!
My script.sh has the task to start a java process and if I look for this java process I see
that the owner of the process is Peter.
You could try with the su command, aka “su bob”. But, maybe it is easier to use rlogin to your own machine, if su doesn’t work. You may try other login facilities as well like ssh, but that shouldn’t be necessary really. (But by all means safer.)
I’m sorry, I don’t use it or such solutions, and you can write man “command name” in the terminal window to learn about the commands yourself. You’ll figure it out, or google it if you don’t.