国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > CentOS > 正文

CentOS VPS入手后的基本優化和安全配置

2020-07-08 12:55:42
字體:
來源:轉載
供稿:網友

適用環境和條件:安裝CentOS5或6的任意VPS

升級系統


復制代碼
代碼如下:

yum update

升級防火墻策略


復制代碼
代碼如下:

#清除現有防火墻規則
iptables -F
iptables -X
iptables -Z
#允許本機訪問本機
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
# 允許已建立的或相關連的通行
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</p><p>
#允許有限的ping功能,每秒10次
iptables -A INPUT -p icmp -m limit --limit 10/sec -j ACCEPT</p><p>
#允許所有本機向外的訪問
iptables -A OUTPUT -j ACCEPT</p><p>
# 允許訪問22端口,默認的SSH端口,請先保留,等修改sshd_conf后再進行修改
iptables -A INPUT -p tcp --dport 22 -j ACCEPT</p><p>
#允許訪問80端口
iptables -A INPUT -p tcp --dport 80 -j ACCEPT</p><p>
#允許其他端口只需要修改端口號即可</p><p>
#禁止其他未允許的規則訪問
iptables -A INPUT -j REJECT (注意:如果22端口未加入允許規則,SSH鏈接會直接斷開。)
iptables -A FORWARD -j REJECT</p><p>#保持防火墻規則
service iptables save
#如果保持失敗,是因為缺少policycoreutils,請先安裝
yum -y install policycoreutils
#之后再進行保存
#將iptables加入隨機啟動
chkconfig --level 345 iptables on

刪除不用的應用


復制代碼
代碼如下:

yum remove Deployment_Guide-en-US cups-libs cups
bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils
nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools
syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools
ypbind
#刪除不安全的服務
yum remove telnet rsh ftp rcp
#安裝postfix替代sendmail
yum install postfix
#刪除sendmail
yum remove sendmail
#禁用和刪除xinetd服務
/sbin/service xinetd stop; /sbin/chkconfig xinetd off
rm -rf /etc/xinetd.d


清理不需要的用戶和用戶組


復制代碼
代碼如下:

#復制備份一份passwd和group
cp /etc/passwd /etc/passwd.sav
cp /etc/group /etc/group.sav
#刪除沒用的用戶和用戶組
for a in adm lp sync news uucp operator games gopher mailnull nscd rpc;
do /usr/sbin/userdel $a -f; done
for a in lp news uucp games gopher users floopy nscd rpc rpcuser nfsnobody;
do /usr/sbin/groupdel $a -f; done


更新為香港時區


復制代碼
代碼如下:

ln -sf /usr/share/zoneinfo/Hongkong /etc/localtime


支持zip和unzip


復制代碼
代碼如下:

yum install zip unzip

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 房山区| 凤翔县| 兴国县| 太康县| 高雄县| 博湖县| 揭东县| 丰台区| 卫辉市| 东台市| 惠州市| 伽师县| 新平| 双峰县| 浏阳市| 洪雅县| 莒南县| 廉江市| 桓台县| 商水县| 江孜县| 东宁县| 普陀区| 渭源县| 盐津县| 涿鹿县| 蓝山县| 佳木斯市| 思茅市| 改则县| 安岳县| 高州市| 南靖县| 五常市| 绥芬河市| 吴堡县| 成都市| 墨竹工卡县| 伊金霍洛旗| 鄂尔多斯市| 哈尔滨市|