婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > linux系統(tǒng)安全shell腳本第二版

linux系統(tǒng)安全shell腳本第二版

熱門標(biāo)簽:地圖標(biāo)注小區(qū)項(xiàng)目入駐 凱立德劇院地圖標(biāo)注 曲阜地圖標(biāo)注app 哪個(gè)地圖標(biāo)注更清晰 4s店如何在百度地圖標(biāo)注 漳州外呼系統(tǒng)怎么樣 開封400電話辦理價(jià)格 天津人工電銷機(jī)器人費(fèi)用 內(nèi)蒙古電信外呼系統(tǒng)

使用方法將其復(fù)制,保存為一個(gè)shell文件,比如security.sh.將其上傳到linux服務(wù)器上,執(zhí)行sh security.sh,就可以使用該腳本了!

復(fù)制代碼
代碼如下:

#!/bin/sh
# desc: setup linux system security
# author:coralzd
# powered by www.freebsdsystem.org
# version 0.1.2 written by 2011.05.03
#account setup

passwd -l xfs
passwd -l news
passwd -l nscd
passwd -l dbus
passwd -l vcsa
passwd -l games
passwd -l nobody
passwd -l avahi
passwd -l haldaemon
passwd -l gopher
passwd -l ftp
passwd -l mailnull
passwd -l pcap
passwd -l mail
passwd -l shutdown
passwd -l halt
passwd -l uucp
passwd -l operator
passwd -l sync
passwd -l adm
passwd -l lp

# chattr /etc/passwd /etc/shadow
chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/group
chattr +i /etc/gshadow
# add continue input failure 3 ,passwd unlock time 5 minite
sed -i 's#auth required pam_env.so#auth required pam_env.so\nauth required pam_tally.so onerr=fail deny=3 unlock_time=300\nauth required /lib/security/$ISA/pam_tally.so onerr=fail deny=3 unlock_time=300#' /etc/pam.d/system-auth
# system timeout 5 minite auto logout
echo "TMOUT=300" >>/etc/profile

# will system save history command list to 10
sed -i "s/HISTSIZE=1000/HISTSIZE=10/" /etc/profile

# enable /etc/profile go!
source /etc/profile

# add syncookie enable /etc/sysctl.conf
echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf

sysctl -p # exec sysctl.conf enable
# optimizer sshd_config

sed -i "s/#MaxAuthTries 6/MaxAuthTries 6/" /etc/ssh/sshd_config
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config

# limit chmod important commands
chmod 700 /bin/ping
chmod 700 /usr/bin/finger
chmod 700 /usr/bin/who
chmod 700 /usr/bin/w
chmod 700 /usr/bin/locate
chmod 700 /usr/bin/whereis
chmod 700 /sbin/ifconfig
chmod 700 /usr/bin/pico
chmod 700 /bin/vi
chmod 700 /usr/bin/which
chmod 700 /usr/bin/gcc
chmod 700 /usr/bin/make
chmod 700 /bin/rpm

# history security

chattr +a /root/.bash_history
chattr +i /root/.bash_history

# write important command md5
cat > list "EOF"
/bin/ping
/bin/finger
/usr/bin/who
/usr/bin/w
/usr/bin/locate
/usr/bin/whereis
/sbin/ifconfig
/bin/pico
/bin/vi
/usr/bin/vim
/usr/bin/which
/usr/bin/gcc
/usr/bin/make
/bin/rpm
EOF

for i in `cat list`
do
if [ ! -x $i ];then
echo "$i not found,no md5sum!"
else
md5sum $i >> /var/log/`hostname`.log
fi
done
rm -f list

本文出自 崔曉輝的博客 http://coralzd.blog.51cto.com/90341/564887

標(biāo)簽:莆田 綿陽 南京 開封 陽泉 武漢 南陽 黔南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux系統(tǒng)安全shell腳本第二版》,本文關(guān)鍵詞  linux,系統(tǒng),安全,shell,腳本,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《linux系統(tǒng)安全shell腳本第二版》相關(guān)的同類信息!
  • 本頁收集關(guān)于linux系統(tǒng)安全shell腳本第二版的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 敦煌市| 凤城市| 舒兰市| 林州市| 苗栗市| 江陵县| 大连市| 名山县| 嘉禾县| 秭归县| 安龙县| 都昌县| 彩票| 横峰县| 桐城市| 洛扎县| 柳州市| 新竹市| 读书| 安徽省| 庆云县| 濮阳县| 西林县| 青浦区| 汉阴县| 中西区| 宣武区| 准格尔旗| 曲沃县| 宽甸| 台州市| 西丰县| 梁河县| 馆陶县| 邹平县| 安徽省| 安阳县| 宁夏| 多伦县| 都昌县| 绥化市|