How do I run a shell script as a specific user?

How do I run a shell script as a specific user?
Answer
The command paths must be absolute! Then call sudo -u user2 /home/user2/bin/test.sh from a user1 shell. Done. This will run the command as username given that you have permissions to sudo as that user.
 

Tìm kiếm

Back
Top