HiBlog Linux and Windows Server

Linux File Permissions Explained: rwx, chmod, and Ownership

  • Ali GhanimatiAuthor
  • Last updated
  • 1 minuteReading time
  • 374Views
  • Ali Ghanimati
  • Last updated:
  • 1 min read
  • 374 views
Linux File Permissions Explained: rwx, chmod, and Ownership

A file can exist and still give a service Permission denied. Linux checks the identity running the process, the file’s permissions, and access to the directories on its path. A configuration file should often be writable by an administrator and only readable by the service.

Identify the account and operation first. Then check the owner, group, and permissions using ls -l. The three groups of permission bits apply to the owner, owning group, and everyone else.

Read the permissions

BitOn a fileOn a directory
rRead its contentsList names
wWrite its contentsChange entries with the required directory access
xExecute itTraverse it or access a known entry

In numeric modes, read is 4, write is 2, and execute is 1. Mode 640 gives the owner read and write, the group read, and others no permissions.

Make the smallest change and test

Use chmod for permissions and chown for ownership. chmod 640 app.conf is suitable only if that is the intended split for that file. Test using the actual service account. If it still fails, check traversal permissions on parent directories and any ACL, SELinux, or AppArmor policy that applies. Linux chmod manual.

Share Post

hidata.org/en/blog/linux-permissions-explained/
In Social Media

Add Comment

Related Articles