6.2.9 Ensure users own their home directories (Scored)
Profile Applicability
Level 1 - Server Level 1 - Workstation
Description
The user home directory is space defined for the particular user to set local environment variables and to store personal files..
Rationale
Since the user is accountable for files stored in the user home directory, the user must be the owner of the directory.
Audit
Run the following script and verify no results are returned:
#!/bin/bash cat /etc/passwd | awk -F: '{ print $1 " " $3 " " $6 }' | while read user uid dir; do if [ $uid -ge 1000 -a -d "$dir" -a $user != "nfsnobody" ]; then owner=$(stat -L -c "%U" "$dir") if [ "$owner" != "$user" ]; then echo "The home directory ($dir) of user $user is owned by $owner." fi fi done
Remediation
Change the ownership of any home directories that are not owned by the defined user to the correct user.