赞
踩
[root@localhost ~]# arping -c 2 -w 1 -I ens33 192.168.247.134
ARPING 192.168.247.134 from 192.168.247.136 ens33
Unicast reply from 192.168.247.134 [00:0C:29:52:4D:89] 1.452ms
Unicast reply from 192.168.247.134 [00:0C:29:52:4D:89] 1.182ms
Sent 2 probes (1 broadcast(s))
Received 2 response(s)
配置ftp匿名访问模式, 首先输入命令“vi /etc/vsftpd/vsftpd.conf” 打开ftp服务具体配置文件
进行修改(有点改,没有的添)(去“#”号)
参数 | 作用 |
---|---|
anonymous_enable=YES | 允许匿名访问模式。 |
anon_umask=022 | 匿名用户上传文件的umask值。 |
anon_upload_enable=YES | 允许匿名用户上传文件 |
anon_mkdir_write_enable=YES | 允许匿名用户创建目录 |
anon_other_write_enable=YES | 允许匿名用户修改目录名或删除目录 |
#!/bin/bash #测试文件是否存在,若存在,就将当前文件备份 [ -f /etc/ethers ] if [ $? -eq 0 ] then cp -p /etc/ethers /etc/ethers.bak fi #去ping254个地址,将成功的ip地址和mac追加到/ethers for ((i=134;i<=139;i++)) do ping -c 3 -w 3 192.168.247.$i &> /dev/null if [ $? -eq 0 ] then echo "192.168.247.$i 存活" fi done arp -n | grep "ether" | awk '{print $1,$3}' > /etc/ethers #检查是否安装nmap扫描软件 rpm -q nmap if [ $? -eq 1 ] then yum clean all yum list yum install nmap -y [ $? -eq 0 ] && echo "未安装namp扫描工具,当前已为您安装" fi #检查有哪些ip开启了匿名服务ftp服务,即22端口 for a in $(cat /etc/ethers | awk '{print $1}') do m=$(nmap -sT $a -p 21 | awk '/ftp/{print $2}') if [ $m = open ] then echo "$a 开启ftp服务" fi done
#!/bin/bash #/根分区的当前占用率 DUG=$(df -Th | grep '/$' | awk '{print $6}' | sed 's/%//') #cpu 的当前空闲占用率 CUG=$(mpstat | grep 'all' | awk '{print $13}' | awk -F. '{print $1}') #内存当前占用率 used=$(free | grep 'Mem' | awk '{print $3}') total=$(free | grep 'Mem' | awk '{print $2}') (( MUG = used*100/total)) genfenquzhanyong=当前根磁盘占用未到警戒线20% cpukongxian=当前cpu空闲资源未低于警戒线1% neicunzhanyong=当前内存占用未超过警戒线10% #当根分区占用率超过10时 if [ $DUG -gt 10 ] then echo `date` >> /tmp/alert.txt echo "当前磁盘占用超过10%" >> /tmp/alert.txt genfenquzhanyong='当前根磁盘占用超过警戒线20%,为$DUG%' fi #当cpu的空闲内存小于20时 if [ $CUG -lt 1 ] then echo `date` >> /tmp/alert.txt echo "当前cpu空闲资源小于1%" >> /tmp/alert.txt cpukongxian='当前cpu空闲资源低于警戒线1%,为$CUG' fi if [ $MUG -gt 10 ] then echo `date` >> /tmp/alert.txt echo "当前内存占用超过10%" >> /tmp/alert.txt neicunzhanyong='当前内存占用超过警戒线10%,为$MUG' fi rpm -q expect if [ $? -ne 0 ] then yum install expect -y fi echo "$genfenquzhanyong,$cpukongxian,$neicunzhanyong" | mail "965483130@qq.com" [root@localhost ~]# crontab -e -u root [root@localhost ~]# crontab -l 30 * * * * /usr/bin/sh /root/sysmon.sh enfenquzhanyong,$cpukongxian,$neicunzhanyong" | mail "965483130@qq.com" [root@localhost ~]# crontab -e -u root [root@localhost ~]# crontab -l 30 * * * * /usr/bin/sh /root/sysmon.sh
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。