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