[Info] Running a command as a different user in Linux without password
In case you need to know how to run a command as a different user in Linux, without entering the password:
Call visudo and add this:
user1 ALL=(user2) NOPASSWD: /home/user2/bin/test.sh
Then you can run the command like this:
sudo su -c "/home/user2/bin/test.sh" -s /bin/sh user2
Note: Your current user must have sudo rights.