Linux - setuid

Run a file as root irrespective of who is running it.

It is a file permission, delegated as `s` allowing current user to execute that file as root. Yeah, kinda like a sudo

To set up setuid:

touch delete.sh

@: ls -l

- rw-r--r-- 1 niva niva 0 Dec 5 17:54 delete.sh

chmod u+s delete.sh

@: ls -l

- rwSr--r-- 1 root root 0 Dec 5 17:54 delete.sh

Obeserve here the letter capital `S`. This means setuid is set, but the user that owns the file does not have execute permissions.

So, file to be executable by user do;

chmod u+x delete.sh

- rwsr--r-- 1 root root 0 Dec 5 17:54 delete.sh