Skip to content

Instantly share code, notes, and snippets.

@hornos
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save hornos/01ccac03d6cfba1efa6f to your computer and use it in GitHub Desktop.

Select an option

Save hornos/01ccac03d6cfba1efa6f to your computer and use it in GitHub Desktop.
#!/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