kota's memex

suid

SUID stands for Set User or group ID on execution. In other words by using this fancy permission we can allow regular users to run certain programs as root without sudo. This comes with a hopefully REALLY OBVIOUS DANGER. If your program isn't absolutely dead fucking simple this could be a very direct root exploit.

So set a program as root SUID you should first make sure it's owned by root and in a proper group, because generally speaking it's safer to allow just a single group to run the command instead of all users. In the case of my backlight program I do this with the following command.

chown root:video /usr/local/bin/backlight
usermod -a -G video kota

And now finally we can use the numerical file permission with chmod to set it as full permissions for owner, read + execute for group, nothing for everyone else and with SUID enabled.

chmod 4750 /usr/local/bin/backlight

numerical file modes

4 = read
2 = write
1 = execute