1)隱藏系統版本信息
>/etc/issue
> /etc/issue.net
2)更改yum源爲國內的yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3)設置字符爲英文字符
echo "LANG=en_US.UTF-8" >/etc/locale.conf
echo "export LC_ALL=C" >>/etc/bashrc
source /etc/bashrc
4)關閉selinux
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0
5)關閉iptables
systemctl stop firewalld
systemctl disable firewalld.service
6)設置命令行歷史記錄保存個數
echo "export HISTSIZE=10" >>/etc/bashrc
source /etc/bashrc
7)設置命令行歷史記錄文件中保存的個數
echo "export HISTFILESIZE=10" >>/etc/bashrc
source /etc/bashrc
8)命令行歷史記錄中不保存以空格開頭的記錄
echo "export HISTCONTROL=ignorespace" >>/etc/bashrc
source /etc/bashrc
9)爲rm命令設置別名
echo "alias rm='Do not use rm command'" >>/etc/bashrc
source /etc/bashrc
10)加大文件描述符
cat >>/etc/security/limits.conf <<EOF
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
* soft stack 65535
* soft stack 65535
EOF
echo "* - proc 65535" > /etc/security/limits.d/20-nproc.conf
11)鎖定/etc/passwd /etc/shadow /etc/group /etc/gshadow文件
chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow
lsattr /etc/passwd /etc/shadow /etc/group /etc/gshadow