CentOS安装系统后的简单设置

标签: Linux

1、ssh

vim /etc/ssh/sshd_config

Port 22 后的22 替换为其他端口

#PermitRootLogin yes

改为

PermitRootLogin no

2、安装denyhosts

sudo yum -y install denyhosts
service denyhosts start

3、添加账号管理员权限

vim /etc/sudoers
## Allow root to run any commands anywhere

下面添加:

%user ALL=(ALL)       NOPASSWD:ALL  #免用户密码登陆root
%user ALL=(ALL)       ALL  #需要用户密码才能登陆root

4、登陆通知脚本

有任何用户登陆的时候都会发一封邮件到指定邮箱,前提是需要先安装mailx。

首先

sudo vim /etc/profile
然后在文件末尾添加
#Login mail to YOURNAME
LOGINDATE=`date +%Y-%m-%d,%H:%M:%S`
LOGINIP=$(who am i | awk '{print $5}' | sed 's/(//g' | sed 's/)//g')
echo -ne "\n  LOGIN AT: $LOGINDATE \n IP查询 http://www.ip138.com/ips138.asp?ip=$LOGINIP&action=2 " | mail -s "USER:$(whoami),LOGIN IP:$LOGINIP,`env|grep HOSTNAME`,HOST  $(ifconfig|sed -n ' 2p'|awk '{print$2}')" mail@domain.com

5、网卡设置

vim /etc/sysconfig/network-scripts/ifcfg-eth0
onboot=yes #设置随开机启动
ifup eth0
6、时间设置
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -s dd/mm/yyyy hh:mm:ss
clock -w

7、NTP时间同步设置

vim /etc/ntp.conf server 210.72.145.44     #这是中国国家授时中心的IP,也可以设置成内网的ntp服务器
server 0.cn.pool.ntp.org

/etc/init.d/ntpd start
chkconfig --level 35 ntpd on
8、History 日志设置
vim /etc/profile
复制以下内容
export HISTTIMEFORMAT='%F %T '

PS1="`whoami`@`hostname`:"'[$PWD]'
history
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /tmp/history ]
then
mkdir /tmp/history
chmod 777 /tmp/history
fi
if [ ! -d /tmp/history/${LOGNAME} ]
then
mkdir /tmp/history/${LOGNAME}
chmod 300 /tmp/history/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date +"%Y%m%d_%H%M%S"`
export HISTFILE="/tmp/history/${LOGNAME}/${USER_IP} history.$DT"
chmod 600 /tmp/history/${LOGNAME}/*history* 2>/dev/null

9、关闭selinux

vim /etc/selinux/config
SELINUX=disabled

注释Selinuxtype

临时关闭命令

setenforce=0

10、添加自启动

可以修改vim /etc/rc.d/rc.local
直接在后面添加目录和命令

11、防火墙按需配置~~~

12、待补完,2333~~~

版权所有:《Hoiwan's 》 => 《CentOS安装系统后的简单设置
本文地址:http://ihoiwan.com/?post=6
除非注明,文章均为 《Hoiwan's 》 原创,欢迎转载!转载请注明本文地址,谢谢。

评论:

Kris
2017-07-18 08:50
The analysis seems to miss the fact that the Tuareg rebels and the local al-Qaeda franchise are separate entities. The rebellion certainly started out as an ethnic separatist movement, but as soon as the Tuaregs expelled the Malian army, the Islamists took over the government of &qtoo;Azawad&qutu;. Their agenda is not ethnic as far as I can tell: they have links with ethnic black Islamists in Nigeria, for example, the so-called Boko Haram.

发表评论: