#!/bin/bash grep -E -v '^(halt|sync|shutdown)' /etc/passwd | awk -F: '($7 != "'"$(which nologin)"'" && $7 != "/bin/false") { print $1 " " $6 }' | while read user dir; do if [ ! -d "$dir" ]; then # echo "No home directory: $dir of user $user" true else owner=$(stat -L -c "%U" "$dir") if [ "$owner" != "$user" ]; then echo ${dir},${user} fi fi done