Other Articles

Servers – Ensure Users' Home Directory Permissions are 750 or More Restrictive

Support > Fixing Checks > Server

06 March, 2026

This check ensures that users' home directories have permissions set to 750 or more restrictive.

Improper permissions on user home directories may allow other users on the system to read, modify, or execute files that belong to another user.

Check Details

  • Resource: Server
  • Check: Verify Home Dirs 750
  • Risk: Group or world-writable user home directories may allow malicious users to read or modify another user's files and potentially gain elevated privileges.

Remediation Steps

  1. Open a terminal session on the server with root or sudo privileges.
  2. Run the following script to identify user home directories with insecure permissions.

    grep -E -v '^(halt|sync|shutdown)' /etc/passwd | \
    awk -F: '($7 != "'"$(which nologin)"'" && $7 != "/bin/false") { print $1 " " $6 }' | \
    while read -r user dir; do
    
        if [ ! -d "$dir" ]; then
            echo "The home directory ($dir) of user $user does not exist."
    
        else
            dirperm=$(ls -ld "$dir" | cut -f1 -d" ")
    
            if [ "$(echo "$dirperm" | cut -c6)" != "-" ]; then
                echo "Group Write permission set on the home directory ($dir) of user $user"
            fi
    
            if [ "$(echo "$dirperm" | cut -c8)" != "-" ]; then
                echo "Other Read permission set on the home directory ($dir) of user $user"
            fi
    
            if [ "$(echo "$dirperm" | cut -c9)" != "-" ]; then
                echo "Other Write permission set on the home directory ($dir) of user $user"
            fi
    
            if [ "$(echo "$dirperm" | cut -c10)" != "-" ]; then
                echo "Other Execute permission set on the home directory ($dir) of user $user"
            fi
        fi
    
    done
    
  3. If any home directories have insecure permissions, update the permissions to 750 or a more restrictive value.

    sudo chmod 750 /home/<username>
    

Note: Changes to user home directory permissions should be reviewed with users or administrators to prevent unexpected access issues.