only return password when given -v option
This commit is contained in:
parent
d85c9f998e
commit
469b9c9b89
|
@ -17,6 +17,7 @@ help()
|
|||
echo ""
|
||||
echo " -h Print this help."
|
||||
echo " -u <username> Only return info about specified username, otherwise all usernames are returned."
|
||||
echo " -v Verbose - include unencrypted passwords, if available."
|
||||
echo " -c CVS - Output in cvs format, instead of tabbed table."
|
||||
}
|
||||
|
||||
|
@ -38,11 +39,16 @@ else
|
|||
usernames=(`ls /home/`)
|
||||
fi
|
||||
|
||||
if [[ -n $verbose ]]; then
|
||||
output="uid username passwd jailed fpmmax"
|
||||
else
|
||||
output="uid username jailed fpmmax"
|
||||
fi
|
||||
|
||||
for username in "${usernames[@]}"
|
||||
do
|
||||
userid=(`stat -c '%u' /home/$username`)
|
||||
if [[ -n $verbose ]]; then
|
||||
if [[ -f /home/$username/.passwd ]]; then
|
||||
password=(`awk -F : '{ print $2 }' /home/$username/.passwd`)
|
||||
if [[ -f /root/.vhost.ini ]]; then
|
||||
|
@ -52,18 +58,24 @@ do
|
|||
else
|
||||
password="(unknown)"
|
||||
fi
|
||||
fi
|
||||
shell=(`grep $username /etc/passwd|awk -F : '{ print $6 }'`)
|
||||
if [[ $shell = "/usr/jails/$username/./home/$username" ]]; then
|
||||
jailed="Yes"
|
||||
else
|
||||
jailed="No"
|
||||
fi
|
||||
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||
fpmmax=(`grep pm.max_children /etc/php/$phpVersion/fpm/pool.d/$username.conf |awk -F = '{ gsub(/ /,""); print $2 }'`);
|
||||
else
|
||||
|
||||
fpmmax=0
|
||||
if [[ -f "/etc/php/$phpVersion/fpm/pool.d/$username.conf" ]]; then
|
||||
fpmax=$(grep pm.max_children /etc/php/$phpVersion/fpm/pool.d/$username.conf | awk -F '=' '{ print $2 }' | tr -d ' ')
|
||||
fi
|
||||
|
||||
if [[ -n $verbose ]]; then
|
||||
output="$output${NL}$userid $username $password $jailed $fpmmax"
|
||||
else
|
||||
output="$output${NL}$userid $username $jailed $fpmmax"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $cvs ]]; then
|
||||
|
@ -71,4 +83,3 @@ if [[ $cvs ]]; then
|
|||
else
|
||||
echo "$output" | column -t
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user