Tuesday, December 29, 2009

little s and upper case S

It is not about little s and big s of Taiwan actress. It is about setuid bit.

s: set when executable
S: set when not executable

hmc@hmc-desktop:~$ touch abc.txt
hmc@hmc-desktop:~$ chmod 644 abc.txt
hmc@hmc-desktop:~$ ls -l abc.txt
-rw-r--r-- 1 hmc hmc 0 2009-12-29 22:40 abc.txt
hmc@hmc-desktop:~$ chmod 4644 abc.txt
hmc@hmc-desktop:~$ ls -l abc.txt
-rwSr--r-- 1 hmc hmc 0 2009-12-29 22:40 abc.txt


hmc@hmc-desktop:~$ touch abcx.txt
hmc@hmc-desktop:~$ chmod 744 abcx.txt
hmc@hmc-desktop:~$ ls -l abcx.txt
-rwxr--r-- 1 hmc hmc 0 2009-12-29 22:40 abcx.txt
hmc@hmc-desktop:~$ chmod 4744 abcx.txt
hmc@hmc-desktop:~$ ls -l abcx.txt
-rwsr--r-- 1 hmc hmc 0 2009-12-29 22:40 abcx.txt

more to read
http://www.zzee.com/solutions/unix-permissions.shtml#setuid