Linux system security Settings shell script

Source: Internet
Author: User

#!/bin/sh# desc:setup Linux system security# powered by Www.lvtao.net#account setuppasswd-L XFSPASSWD-L NEWSPASSWD-L NSCDPASSWD-L DBUSPASSWD-L VCSAPASSWD-L GAMESPASSWD-L NOBODYPASSWD-L AVAHIPASSWD-L HALDAEMONPASSWD-L GOPHERPASSWD-L FTPPASSWD-L MAILNULLPASSWD-L PCAPPASSWD-L MAILPASSWD-L SHUTDOWNPASSWD-L HALTPASSWD-L UUCPPASSWD-Loperatorpasswd-L SYNCPASSWD-L ADMPASSWD-l lp# chattr/etc/passwd/etc/shadowchattr+i/etc/passwdchattr+i/etc/shadowchattr+i/etc/groupchattr+i/etc/gshadow# AddContinueInput failure3, passwd unlock Time5minitesed-I.'S#auth required Pam_env.so#auth required Pam_env.sonauth required pam_tally.so onerr=fail deny=3 unlock_time= 300nauth required/lib/security/$ISA/pam_tally.so onerr=fail deny=3 unlock_time=300#'/etc/pam.d/system-auth# System Timeout5minite Auto Logoutecho"tmout=300">>/etc/profile# would system save History command list toTensed-I."s/histsize=1000/histsize=10/"/etc/profile# Enable/etc/profile go!Source/etc/profile# Add Syncookie enable/etc/Sysctl.confecho"Net.ipv4.tcp_syncookies=1">>/etc/Sysctl.confsysctl-P # exec sysctl.conf enable# optimizer sshd_configsed-I."s/#MaxAuthTries 6/maxauthtries 6/"/etc/ssh/sshd_configsed-I."s/#UseDNS yes/usedns no/"/etc/ssh/sshd_config# limit chmod important Commandschmod the/bin/Pingchmod the/usr/bin/Fingerchmod the/usr/bin/Whochmod the/usr/bin/Wchmod the/usr/bin/Locatechmod the/usr/bin/Whereischmod the/sbin/Ifconfigchmod the/usr/bin/Picochmod the/bin/Vichmod the/usr/bin/Whichchmod the/usr/bin/Gccchmod the/usr/bin/Makechmod the/bin/rpm# History securitychattr+a/root/. Bash_historychattr+i/root/. bash_history# Write important command Md5cat> 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 forIinch' Cat list ' Do if[!-X $i];then Echo"$i not found,no md5sum!" Elsemd5sum $i >>/var/log/' hostname '. Logfidonerm-F List

Execute SH security.sh

Linux system security Settings shell script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.