Back to Notes
rhcsaNODE: #rhcsa-user-group-posix-acls

User Management, Special Permissions, and POSIX Access Control Lists (ACLs)

Managing Linux users, groups, sudo privileges, SUID/SGID/Sticky special permissions, and granular file access control lists with getfacl and setfacl in RHEL 9.

AKA:POSIX ACLs, setfacl, getfacl, SGID, sudoers
#rhcsa#redhat#linux#security#permissions#acls#rhel9#sysadmin

User Management, Special Permissions, and POSIX Access Control Lists (ACLs)

Standard UNIX permission models assign rwx permissions to User, Group, and Other. RHCSA tasks frequently require collaboration directories with SGID and granular user permissions using POSIX ACLs.

1. User & Group Administration

# Create user with specific UID and supplementary groups
useradd -u 2005 -G devops,wheel -s /bin/bash engineer1

# Set password and password expiration policies
echo "Password123" | passwd --stdin engineer1
chage -M 90 -W 7 engineer1 # Max 90 days, 7 day warning

# Configure sudo privileges via drop-in file (never edit /etc/sudoers directly)
echo "%devops ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd" > /etc/sudoers.d/devops
chmod 0440 /etc/sudoers.d/devops

2. Special Permissions (SUID, SGID, Sticky Bit)

  • SGID on Directories (chmod 2770 /project): Any file created inside inherits the group ownership of the directory rather than the primary group of the creating user.
  • Sticky Bit (chmod 1777 /tmp): Users can only delete or rename files that they personally own.
# Setup collaborative shared folder:
mkdir /opt/collab
chown :devops /opt/collab
chmod 2770 /opt/collab

3. Granular Access Control Lists (POSIX ACLs)

When standard permissions cannot grant read/write access to a third user without opening permissions to the entire world, use setfacl:

# Inspect current permissions and ACL entries
getfacl /opt/collab

# Grant user 'consultant' read & write access
setfacl -m u:consultant:rwx /opt/collab

# Set DEFAULT ACL so future files automatically inherit permissions
setfacl -m d:u:consultant:rwx /opt/collab
setfacl -m d:g:devops:rwx /opt/collab

# Remove all extended ACLs
setfacl -b /opt/collab

Cross-references: