Tag Archives: unix

Elevating privileges temporarily with setuid permission (Unix)

You may have noticed that apart from the read (r), write (w) and executable (x) permissions in Unix, there’s an ‘s’ permission as well. This is called the setuid permission. If you have access to an setuid-enabled file, then you can execute that file with admin privileges even though you’re an unprivileged user. So, s means that the file is both executable and has root privileges.

Unix setuid permission

It’s possible to add enable setuid permission just as you do with any other permission.

chmod u+s filename

Be wary though, mistakenly assigned setuid can cause havoc if some stupid user takes advantage of the root privileges.