$ls -l //this is a list command with the -l option list the files information in long mode
this information devided into four parts
– = File type. Most common file types are – A normal file. d = directory, l = sympolic link s = a socket, p = a fifo pipe.
rw- = User permission. we got 3 stages read,write, execute. If something denied the letter´s position is held by a dash.
-rw = group permission
r–= other permission
If we want this permission rwxr-x–x in binary is 111101001 if we treat this as a series of thee groups of octal numbers, the value is 751.
change permission on a specific group
chmod g-r a.txt //which means ¨remove group read permission¨
SET A STICKY Bit
$chmod +t (folder name) // if a sticky bit is set every user can remove his files on this folder.
A perfect example of a directory that has the sticky bit set is /tmp, that all users can access for temporary files and directories. All users can create files and dirs but users can remove only files that they own.
set-user-id-bit (suid) which makes the programm run as the file owner .
you can set it chmod u+s (filename)
Similarly we got set-group-id (sgid)
chmod g+s (filename)
Source : Hacking Linux Exposed Second Edition ISBN 0-07-222564-5