User and Group Privilege

type ls -al in the terminal

Privilege: There are 10 bits in privilege part.

bit 1:

[d] – directory

[-] –  file

[l] – link file

[b] – interface devices

[c] – serial port devices, such as mouse, keyboard

bit 2-4: privilege of the file owner. read, write and execute

bit 5-7: privilege of the group

bit 8-10 privilege of other users

links: number of files link to this i-node.

owner, group, size, modified date, filename: self-explained.


chmod change mode

e.g chmod u+r [filename]

chgrp change group

chown change owner.

umask – 新建目录、文件的默认属性。

实际上,新建目录的默认属性为 drwxrwxrwx 777

新建文件的默认属性为 -rwxrw-rw- 766



则新建目录的默认属性为:(drwxrwxrwx) – (d——-w-) = drwxrwxr-x

新建文件的默认属性为:(-rwxrw-rw-) – (——–w-) = -rwxrw-r–

lsattr – list attribute

chattr – change attribute

  1. [i] 文件不能被改名,删除,更改或增加数据,添加链接。对系统安全有很大帮助,只有root可以设置该选项。
  2. [s] 如果文件被删除,则直接从硬盘上完全删除。
  3. [u] 与[s]相反,如果文件被删除,则只删除它的i-node。数据还在硬盘上,并可以恢复。
  4. [a] 文件只能被增添数据,不能删除,修改旧数据。常用于日志文件。

文件特殊权限: SUID, SGID, SBIT


例:file /initrd.img


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.