vsftpd服务匿名检查
#!/bin/bash
# Host IP/主机ip
ipaddr="$1"
# Change LANG To C
# oldLANG=$LANG
# export LANG=C
LANG=en_us
# $1 临时数据存放点
root_time=`chage -l root |head -1 |awk -F ':' '{print $2}' | sed 's/ //g' | sed 's/,/-/g'`
dnt_time=`chage -l dntman |head -1 |awk -F ':' '{print $2}' | sed 's/ //g' | sed 's/,/-/g'`
echo "密码修改,root:$root_time;dntman:$dnt_time,0"
service vsftpd status &>/dev/null
if [[ $? == 0 ]];then
cat /etc/vsftpd/vsftpd.conf 2>/dev/null|grep -Ei '^anonymous_enable.*YES$'
if [[ $? == 0 ]];then
echo 'FTP匿名检测,检查失败,失败'
else
echo 'FTP匿名检测,通过,0'
fi
else
echo 'FTP匿名检测,未启用,0'