I have a script with name "somescript", which has executable permissions for everyone (755) but when I try to run it with a non-root user it keeps asking root password. I even tried setting to 4755 with no luck. Only admin user and user with root password run the script currently.
How can I make it so that, any user can run the script (but not change it)
-rwxr-xr-x 1 root group1 2841 Jul 8 2014 somescript
user@node:~> somescript
root's password:
Edit: After tring Setuid and Setgid and seeing them not working I inspected more through script and found out script is checking for user name root, if not executing via sudo which forces to use root password. Commenting out this script should make it work via setting setuid as its owner is root.
if [ "$uid" != "root" ]
then
exec sudo /someplace/somescript
else