本篇內(nèi)容主要講解“安裝Linux系統(tǒng)調(diào)優(yōu)及安全設置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“安裝Linux系統(tǒng)調(diào)優(yōu)及安全設置方法”吧!
本篇內(nèi)容主要講解“安裝Linux系統(tǒng)調(diào)優(yōu)及安全設置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“安裝Linux系統(tǒng)調(diào)優(yōu)及安全設置方法”吧!
1.1 關閉SElinux功能
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
1.2 設定運行級別為3(文本模式)
/etc/inittab
systemctl get-default multi-user.target
1.3 精簡開機系統(tǒng)啟動 sshd、rsyslog、network、crond、sysstat
centos6:
LANG=en
chkconfig --list
chkconfig --list | grep "3:on" | grep -E "sshd|rsyslog|network|crond|sysstat" | awk '{print "chkconfig " $1 " on"}'| bash
chkconfig --list | grep "3:on" | grep -vE "sshd|rsyslog|network|crond|sysstat" | awk '{print "chkconfig " $1 " off"}'| bash
成都創(chuàng)新互聯(lián)為客戶提供專業(yè)的成都做網(wǎng)站、網(wǎng)站建設、程序、域名、空間一條龍服務,提供基于WEB的系統(tǒng)開發(fā). 服務項目涵蓋了網(wǎng)頁設計、網(wǎng)站程序開發(fā)、WEB系統(tǒng)開發(fā)、微信二次開發(fā)、手機網(wǎng)站開發(fā)等網(wǎng)站方面業(yè)務。
centos7:
1.4 關閉iptables防火墻
systemctl stop firewalld.service
systemctl disable firewalld.service
1.5 更改SSH遠程登錄的配置
Port 52113
Use no
PermitRootLogin yes
PermitEmptyPasswords no
GSSAPIAuthentication no
1.6 利用sudo控制用戶對系統(tǒng)命令的使用權限
visudo(/etc/sudoers)
glk All=(All) NOPASSWD:All
1.7 Linux中文顯示設置
cat /etc/sysconfg/i18n
echo 'LANG="zh_CN.UTF-8" ' > /etc/sysconfg/i18n
1.8 設置Linux服務器時間同步
/usr/sbin/ntpdate ntp1.aliyun.com
echo "*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com &> /dev/null" >> /var/spool/cron/root
1.9 歷史記錄數(shù)和登錄超時環(huán)境變量設置
1.設置限制賬號超時時間 export TMOUT=10
2.設置Linux的命令行的歷史記錄數(shù) export HISTSIZE=1000
3.歷史文件的命令數(shù)量變量 export HISTFILESIZE=1000
1.10 調(diào)整Linux系統(tǒng)文件描述符數(shù)量
查看 ulimit -n
echo "* - nofile 65535" >> /etc/security/limits.conf
1.11 Linux服務器內(nèi)核參數(shù)優(yōu)化
net.core.rmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.ip_local_port_range = 1024 65500
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_mem = 786432 1048576 1572864
1.12 定時清理郵件服務器臨時目錄垃圾文件
centos6:
find /var/spool/postfix/maildrop/ -type f | xargs rm -rf
centos5:
find /var/spool/postfix/clientmqueue/ -type f | xargs rm -rf
1.13 隱藏Linux版本信息
> /etc/issue
> /etc/issue.net
1.14 鎖定關鍵系統(tǒng)文件,防止被提權篡改
上鎖命令: chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/inittab
解鎖命令: chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/inittab
1.15 清楚多余的系統(tǒng)虛擬賬號
不必要的賬號: bin adm lp halt mail uucp operator games gopher ftp dbus vcsa abrt ntp saslauth postfix tcpdump
1.16 為grub菜單加密
1./sbin/grub-md5-crypt生成MD5密碼串
2.把密碼串放入grub.conf文件splashimage和title之間
password --md5 $1$hoY96$dM9G1bjKLbi/GV8J9neOm1
1.17 禁止Linux系統(tǒng)被ping
內(nèi)核級禁ping:
echo "net.ipv4.icmp_echo_ignore_all = 1" > /etc/sysctl.conf
解除內(nèi)核級禁ping:
刪除/etc/sysctl.conf中的 "net.ipv4.icmp_echo_ignore_all = 1",保存后執(zhí)行以下命令:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
防火墻級別禁ping:
iptables -t filter -I INPUT -p icmp -icmp-type 8 -i eth0 -s 192.168.1.0/24 -j ACCEPT
1.18 升級具有典型漏洞的軟件版本
rpm -qa openssl openssh bash
yum -y install openssl openssh bash
分享題目:安裝Linux系統(tǒng)調(diào)優(yōu)及安全設置方法
網(wǎng)頁URL:http://aaarwkj.com/article4/ejgpoe.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供App設計、移動網(wǎng)站建設、網(wǎng)站建設、虛擬主機、定制開發(fā)、外貿(mào)網(wǎng)站建設
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)