Tìm hiểu về hệ thống tập tin & phân quyền trên Linux

Giới thiệu tóm tắt

  • Hệ thống tập tin

  • Phân quyền

Hệ thống tập tin

A simple description of the UNIX system, also applicable to Linux, is this:

"On a UNIX system, everything is a file; if something is not a file, it is a process."

Tổng quát

Symbol
  • - regular file
  • d Directory: files that are lists of other files
  • l Link: a system to make a file or directory visible in multiple parts of the system's file tree
  • c Special file: the mechanism used for input and output. Most special files are in /dev
  • s Socket: a special file type, similar to TCP/IP sockets, providing inter-process networking protected by the file system's access control
  • p Named pipe: act more or less like sockets and form a way for processes to communicate with each other, without using network socket semantics
  • b Block device

inode

In a Unix-style file system, an index node, informally referred to as an inode, is a data structure used to represent a filesystem object, which can be one of various things including a file or a directory. Each inode stores the attributes and disk block location(s) of the filesystem object's data.[1] Filesystem object attributes may include manipulation metadata (e.g. change,[2] access, modify time), as well as owner and permission data (e.g. group-id, user-id, permissions).[3]

Phân quyền

Kiểu quyền

  • Read: The Read permission refers to a user's capability to read the contents of the file.

  • Write: The Write permissions refer to a user's capability to write or modify a file or directory.

  • Execute: The Execute permission affects a user's capability to execute a file or view the contents of a directory.

Đối tượng áp dụng

  • Owner - The Owner permissions apply only the owner of the file or directory, they will not impact the actions of other users.
  • Group - The Group permissions apply only to the group that has been assigned to the file or directory, they will not effect the actions of other users.
  • All users - The All Users permissions apply to all other users on the system, this is the permission group that you want to watch the most.

Xem và thay đổi quyền

ls -l, chmod, chown

The most common umask setting is 022. The /etc/profile script is where the umask command is usually set for all users.

3 permissions with on/off state -> 2^3 = 8 possible combinations
r = 4, w = 2, x = 1

The root user

On a Linux system there are only 2 people usually who may change the permissions of a file or directory

Tham khảo

  • https://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions
  • http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html
  • http://www.tldp.org/LDP/intro-linux/html/sect_03_01.html

Hỏi & Trả lời

Linux Files, Permissions

By Sang Lê Thanh

Linux Files, Permissions

  • 757