Field Notes

06 / Unix

Reading Unix permissions.

Read the owner, group, and access bits before reaching for chmod.

2 MIN READ · A PRACTICAL FIELD NOTE

Permission errors become easier to understand when you separate the file, its parent directories, and the identity of the process using it.

Read the three groups

ls -l example.txt
ls -ld .

The access bits are grouped for the owner, group, and others. For a regular file, read permits reading, write permits modification, and execute permits execution, subject to other system checks.

Directories have different jobs

Read access allows listing directory entries. Search access, represented by the execute bit, allows traversing the directory. Access to a file can fail because a parent directory cannot be searched.

Check the process identity

id
stat example.txt

Your shell and a background service may use different users and groups. Test with the relevant identity in mind.

Make the narrowest useful change

Check ownership and ACLs before changing a mode. Avoid broad recursive permission changes when the problem concerns one path.

Further reading: Linux inode and permission documentation.

All notes