Archive

Archive for the ‘Permission’ Category

Umask and sticky bit

January 9, 2012 Leave a comment

1. File and directory permission

rwxrwxrwx    — 777

r — 4

w — 2

x — 1

ugoa — user, group, other, all

2. Set umask

Preset the permission for files and directories to be created.

# umask    — show the umask value

777 – umask  —> for directories

777 – umask – 111 —> for files

3. Set sticky bit

  • SUID — 4, GUID –2, Sticky — 1
  • Sticky bit — a “t” at the end of others, for the directories, only the owner can delete files under that directories

— if “x” missing, “t” becomes “T”

# chmod 1777 dir1

# chmod +t dir2

# chmod o+t dir3

  • SUID — a “s” at the end of owner, for script, who run the script would act as the script owner

— if “x” missing, “s” becomes “S”

# chmod 4777 file1

# chmod u+s file1

  • SGID — a “s” a the end of group, for files. action as the group users

— if “x” missing, “s” becomes “S”

# chmod 2777 file1

# chmod g+s file2

Categories: Permission