范文为教学中作为模范的文章,也常常用来指写作的模板。常常用于文秘写作的参考,也可以作为演讲材料编写前的参考。那么我们该如何写一篇较为完美的范文呢?下面是小编帮大家整理的优质范文,仅供参考,大家一起来看看吧。
linux系统如何防止休眠篇一
linux是一个多用户的系统,一旦人家取得你的root用户之后,他就可以在你的系统上为所欲为了,由于单用户对系统有完全的控制权限,如果操作不当或被他人进入,那么后果将不堪设想,如何防止入行单用户了,有以下几个注意的方面。
1、对/etc/inittab文件进行保护,如果把id:3: initdefault中的3改为成1,就可以每次启动直接进入到单用户方式。对/etc/inittab文件,以root身份进入通过chown 700 /etc/inittab把属性设为其它用户不能修改就行了。
2、如果是使用的lilo方式进行引导,把引导时等待输入时间设置为0或最短时行。这种情况下,如果进入单用户方式,可以用软盘进行引导。
3、如果使用是grub方式进行引导,最简单的方法是使用grub密码,对启动选项进行保护。
4、为了防止他人远程进行破坏,使系统重启,除了对root的密码和/etc目录下的文件进行有效管理之外,还应当对cmos进行密码设置,这样即使把系统改成单用户方式了,也无法直接的启动计算机进行操作。
vps常用安全设置(linux)(一)
vi /etc/ssh/sshd_config
找到其中的#port 22(第13行),去掉#,修改成port 3333
使用如下命令,重启ssh服务,注:以后用新端口登陆。
service sshd restart
先添加一个新帐号80st ,可以自定义:
useradd 80st
给weidao 帐号设置密码:
passwd 80st
仍旧是修改/etc/ssh/sshd_config文件,第39行:#permitrootlogin yes,去掉前面的#,并把yes改成no,然后,重启ssh服务。以后,先使用weidao 登陆,再su root即可得到root管理权限。
login as: 80st
weidao@ip password:*****
last login: tue nov 22 15:18:18 2011 from 1.2.3.4
su root
password:*********** #注这里输入root的密码
使用netstat命令,查看vps当前链接确认是否受到攻击:
netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
ip前面的数字,即为连接数,如果说正常网站,几十到一百都属于正常连接,但出现几百,或上千的就可以垦定这个ip与你的vps之间可能存在可疑连接现象。
可以使用iptables直接ban了这个ip的永久访问:
iptables -a input -s 12.34.56.78 -j drop
使用软件ddos deflate来自动检测并直接ban掉的方法,首先要确认一下iptables服务状态,默认centos就安装的.,不看也行。
service iptables status
安装ddos deflat:
wget http:///scripts/ddos/
chmod +x
./
安装后需要修改/usr/local/ddos/,主要是apf_ban=1要设置成0,因为要使用iptables来封某些可疑连接,注意email_to=”root”,这样ban哪个ip会有邮件提示:
##### paths of the script and other files
progdir=”/usr/local/ddos”
prog=”/usr/local/ddos/”
ignore_ip_list=”/usr/local/ddos/” //ip地址白名单
cron=”/etc/cron.d/”//定时执行程序
apf=”/etc/apf/apf”
ipt=”/sbin/iptables”
##### frequency in minutes for running the script
##### caution: every time this setting is changed, run the script with –cron
##### option so that the new frequency takes effect
freq=1 //检查时间间隔,默认1分钟
##### how many connections define a bad ip? indicate
that below.
no_of_connections=150 //最大连接数,超过这个数ip就会被屏蔽,一般默认即可
##### apf_ban=1 (make sure your apf version is atleast 0.96)
##### apf_ban=0 (uses iptables for banning ips instead of apf)
apf_ban=1 //使用apf还是iptables。推荐使用iptables,将apf_ban的值改为0即可。
##### kill=0 (bad ips are’nt banned, good for interactive execution of script)
##### kill=1 (recommended setting)
kill=1 //是否屏蔽ip,默认即可
##### an email is sent to the following address when an ip is banned.
##### blank would suppress sending of mails
email_to=”root”//当ip被屏蔽时给指定邮箱发送邮件,推荐使用,换成自己的邮箱即可
##### number of seconds the banned ip should remain in blacklist.
ban_period=600 //禁用ip时间,默认600秒,可根据情况调整
安装iftop软件:
yum -y install flex byacc libpcap ncurses ncurses-devel libpcap-devel
wget http:///pdw/iftop/download/
tar zxvf
cd iftop-0.17
./configure
make && make install
安装后,使用iftop运行,查看网络情况。tx,发送流量;rx,接收流量;total,总流量;cumm,运行iftop期间流量;peak,流量峰值;rates,分别代表2秒、10秒、40秒的平均流量。
快捷键:h帮助,n切换显示ip主机名,s是否显示本机信息,d是否显示远端信息,n切换端口服务名称,b切换是否时数流量图形条。
现在最新版是0.8.53,如果以后出新版,只要更新版本号就可以,在ssh里运行:
wget http:///download/
tar zxvf
cd nginx-0.8.53
./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module
make
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/
cd objs/
cp nginx /usr/local/nginx/sbin/
/usr/local/nginx/sbin/nginx -t
kill -usr2 `cat /usr/local/nginx/logs/`
kill -qui
t `cat /usr/local/nginx/logs/`
/usr/local/nginx/sbin/nginx -v
cd ..
cd ..
rm -rf nginx-0.8.53
rm -rf
1.查看所有80端口的连接数
netstat -nat|grep -i “80″|wc -l
2.对连接的ip按连接数量进行排序
netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
3.查看tcp连接状态
netstat -nat |awk ‘{print $6}’|sort|uniq -c|sort -rn
netstat -n | awk ‘/^tcp/ {++s[$nf]};end {for(a in s) print a, s[a]}’
netstat -n | awk ‘/^tcp/ {++state[$nf]}; end {for(key in state) print key,” ”,state[key]}’
netstat -n | awk ‘/^tcp/ {++arr[$nf]};end {for(k in arr) print k,” ”,arr[k]}’
netstat -n |awk ‘/^tcp/ {print $nf}’|sort|uniq -c|sort -rn
netstat -ant | awk ‘{print $nf}’ | grep -v ‘[a-z]‘ | sort | uniq -c
4.查看80端口连接数最多的20个ip
netstat -anlp|grep 80|grep tcp|awk ‘{print $5}’|awk -f: ‘{print $1}’|sort|uniq -c|sort -nr|head -n20
netstat -ant |awk ‘/:80/{split($5,ip,”:”);++a[ip[1]]}end{for(i in a) print a,i}’ |sort -rn|head -n20
5.用tcpdump嗅探80端口的访问看看谁最高
tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -f”.” ‘{print $1″.”$2″.”$3″.”$4}’| sort | uniq -c | sort -nr |head -20
6.查找较多time_wait连接
netstat -n|grep time_wait|awk ‘{print $5}’|sort|uniq -c|sort -rn|head -n20
7.找查较多的syn连接
netstat -an | grep syn | awk ‘{print $5}’ | awk -f: ‘{print $1}’ | sort | uniq -c | sort -nr | more
linux中php如何安装curl扩展方法
如果php已经在系统编译好,后来又需要添加新的扩展。一种方式就是重新完全编译php,另一种方式就是单独编译扩展库,以extension的形式扩展。下面以安装curl扩展为例:
1、下载curl安装包。(我的php是4.4.4的,下载最新的curl 7.16 不能使用,最后下载7.14的才可以,所以要注意一下版本问题)
./configure
make
php要求curl的目录要有include和lib目录,并且include下要有easy.h 和curl.h两个文件,lib下要有libcurl.a。经编译后include下的文件有了,但是lib目录下没有。原来生成到lib/.libs目录下,所以要copy到lib目录
2、进入安装原php的源码目录
cd ext
cd curl
phpize
./configure --with-curl=dir
make
就会在phpdir/ext/curl/moudles/的文件。
3、文件到extensions的配置目录,就好
s("content_relate");【linux操作系统下防黑实用技巧】相关文章:
1. linux操作系统下串口设置及编程2.linux操作系统的安装3.国产操作系统红旗linux简介4.vista操作系统的实用技巧5.windows 操作系统的实用技巧6.linux操作系统使用命令总结7.linux操作系统教程:测试vsftpd服务8.linux下git的使用

一键复制