I noticed that in ubuntu, mktemp allows a user to make temporary files in a directory even if write permissions are not allowed for that user. I thus expected the permissions on mktemp to read something like this, giving the user temporary root privileges while running it:
-rwsr-xr-x 1 root root 35392 Nov 19 2012 mktemp
but instead they read something like this:
-rwxr-xr-x 1 root root 35392 Nov 19 2012 mktemp
Where I thought there was an 's', there is an 'x', meaning mktemp does not run with root privileges. How is mktemp able to create temporary files in a directory without having the permission to do so?