Standard permissions in Linux are simple and direct, and they can be used to manage files and file shares on many different filesystems and file-sharing protocols. An access control list (ACL) adds even more functionality to Linux permissions. This article covers just a few permissions basics and provides links to other great Enable Sysadmin content that delves into permissions and ACLs in more detail.

Standard Linux permissions

Standard Linux permissions involve three identities and three levels of access.

Identities:

  • User (u): One user or owner of the resource
  • Group (g): One identified group
  • Others (o): Everyone who is not the user or in the group listed above

Access levels:

  • Read (r): View the contents of a file or directory
  • Write (w): Write to a file or directory
  • Execute (x): Run an executable, such as a script, and change directories using the cd command

Configure permissions

You set permissions by using the chmod command. Access levels can be defined by using either absolute or symbolic mode with chmod. For more details, see my article How to manage permissions for users, groups, and others. Shawshank Nandishwar Hedge also provides an overview of the chmod command in Linux permissions: An introduction to chmod.

Display permissions

You display permissions by using the ls -l command. The primary related output has nine fields:

  • The first three fields (leftmost) define rwx settings for the user
  • The second three fields define the permissions for the associated group
  • The final (rightmost) three fields display the permissions for others

Suraj Patil covers the ls command in the article Getting started with ls.

[ Get more tips by downloading the Bash shell scripting cheat sheet. ]

Special permissions

Probably the most complex part of Linux permissions is the Set owner User ID (SUID), Set Group ID up on execution (SGID), and sticky bit settings. These settings allow different functions and require some experimentation to understand fully.

  • SUID: Set user ID—execute programs as another user
  • SGID: Set group ID—define group inheritance within a directory
  • Sticky bit: Load files into memory

All three settings offer more functionality than what's listed here.

Tyler Carrigan covered these three special permissions in Linux permissions: SUID, SGID, and sticky bit. It's well worth your time to try various scenarios with all three settings.

Access control lists

One concern with standard permissions is that you can define only a single user and a single group. This makes it more difficult to grant user A read-write on a file, but user B read-only. Access control lists allow sysadmins to define different access levels for different users and groups, providing far more functionality. The use of ACLs is a feature of the filesystem, but most modern Linux filesystems now support this level of access control.

You display ACL settings using the getfacl command and configure them with the setfacl command. Glen Newell covers ACLs in detail in An introduction to access control lists (ACLs). Glen even provides a few example scenarios to work through.

Audit permissions

It's also helpful to display existing permissions for security documentation, auditing reports, or ensuring you configured access to resources correctly. You can use the find command to display permissions on resources. I wrote about using find this way in How to audit permissions with the find command. I encourage you to work with find to ensure users have the proper access levels to files and directories.

Wrapping up

Some aspects of Linux permissions can be tricky, especially for newer Linux sysadmins. Enable Sysadmin has many articles that review both standard permissions and ACLs. Rely on these articles to provide you with the skills necessary to manage Linux systems successfully.


关于作者

Damon Garn owns Cogspinner Coaction, LLC, a technical writing, editing, and IT project company based in Colorado Springs, CO. Damon authored many CompTIA Official Instructor and Student Guides (Linux+, Cloud+, Cloud Essentials+, Server+) and developed a broad library of interactive, scored labs. He regularly contributes to Enable Sysadmin, SearchNetworking, and CompTIA article repositories. Damon has 20 years of experience as a technical trainer covering Linux, Windows Server, and security content. He is a former sysadmin for US Figure Skating. He lives in Colorado Springs with his family and is a writer, musician, and amateur genealogist.

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来