Last active
August 29, 2015 14:01
-
-
Save hornos/01ccac03d6cfba1efa6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _user=${1:-$USER} | |
| _home="/home/${_user}" | |
| _dir=$(readlink ${_home} || echo ${_home}) | |
| _stat=$(stat -c "%a %G %U %n" ${_dir}) | |
| _mode=$(echo ${_stat} | awk '{print $1}') | |
| _sgroup=$(echo ${_stat} | awk '{print $2}') | |
| _suser=$(echo ${_stat} | awk '{print $3}') | |
| if test ${_mode} -gt 750; then | |
| echo "Permission Warning: ${_stat}" | |
| fi | |
| if ! test "${_user}" = "${_suser}"; then | |
| echo "User Error: ${_stat}" | |
| fi | |
| if ! test "${_user}" = "${_sgroup}"; then | |
| echo "Group Error: ${_stat}" | |
| fi | |
| finger ${_user} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment