There is a Linux (CentOS 7). This Linux has two standard user - "user1" and "user2".
There is a script located here: "/home/user2/scripts/script1.sh".
User1 can execute this script by running the command: "su user2 /home/user2/scripts/script1.sh" while the console will prompt for a password from user2.
The password I know, but how can I add this password in the command to run immediately, without prompting for a password?
Found a version of "su user2:password /home/user2/scripts/script1.sh" but it's not working, says things like "su: user user2:password does not exist".
Tell me how to overcome?