This question already has an answer here:
When I execute a script that uses the "mount" command, I need to enter my sudo password. However, I can launch a file explorer like nautilus and mount a filesystem from that application, without ever having to enter a password. What is the mechanism that allows some programs to execute commands that normally require root privilege?
My first instinct was that it is suid, but I changed the owner of a script to root and set the suid flag, i.e., "chmod 4777", but still I cannot perform things in the script that require root privilege.