Post

List Permissions for All Directories in a Path

List Permissions for All Directories in a Path

Checking Directory Permissions with namei

The namei command is a powerful tool for displaying the permissions of each directory in a path. This is particularly useful for troubleshooting permission-related issues.

Basic Usage

1
2
# Display permissions for all directories in a path
namei -m /path/to/directory

Example Output

1
2
3
4
5
6
7
root@wintermute:~# namei -m /root/XenBackup/Xen_PXE_Install/webroot/
f: /root/XenBackup/Xen_PXE_Install/webroot/
drwxr-xr-x /
drwx------ root
drwxrwxrwx XenBackup
drwxrwxrwx Xen_PXE_Install
drwxrwxrwx webroot

Common Use Cases

  • Troubleshooting Apache 403 Errors: Very useful to troubleshoot Apache2 403 permission errors when the document root has been changed from the default
  • Identifying Permission Bottlenecks: Quickly spot directories in a path that might be blocking access
  • Security Auditing: Review permission settings for sensitive directory paths

Additional Options

1
2
3
4
5
6
7
8
# Show owner and group information as well
namei -mo /path/to/directory

# Follow symbolic links
namei -ml /path/to/directory

# Combine options
namei -mlo /path/to/directory
This post is licensed under CC BY 4.0 by the author.