Centos安装后的一些必要处理工作

1永久关闭selinux,修改成permissive或者disabled(建议),修改完需重启

2配置network

3.禁止ping(可选,一般不需要禁止)(默认为0位启用ICMP协议,1为禁止),修改完无须重启

  1. [root@oracle ipv4]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all  

或者在sysctl.conf中添加

  1. [root@mysql ~]# echo "net.ipv4.icmp_echo_ignore_all=1" >> /etc/sysctl.conf  
  2. [root@mysql ~]# tail -1 /etc/sysctl.conf  
  3. net.ipv4.icmp_echo_ignore_all=1  
  4. [root@mysql ~]# sysctl -p  

(可选)登陆后显示信息,在""中输入需要在登陆后显示的信息

  1. [root@oracle ~]# echo "It is product environment,be careful..." > /etc/motd  

5.修改默认ssh设置,增加系统安全性
备份sshd_config文件

 [root@mysql ssh]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.20150915  

修改如下配置 

    1. //修改ssh远程连接的默认端口  
    2. #Port 22  
    3. 修改成  
    4. Port 2510端口号自己指定  
    5.   
    6. //ssh不允许root用户登录  
    7. #PermitRootLogin yes  
    8. 修改成  
    9. PermitRootLogin no  
    10.   
    11. //解决DNS解析慢的问题  
    12. #UseDNS yes  
    13. 修改成  
    14. UseDNS no  
    15.   
    16. //解决ssh慢的问题  
    17. #GSSAPIAuthentication no  
    18. GSSAPIAuthentication yes  
    19. 修改成  
    20. GSSAPIAuthentication no  
    21. #GSSAPIAuthentication yes  

6.优化终端超时,终端超过600秒自动断开

  

  •       [root@mysql ~]# echo "export TMOUT=600" >> /etc/profile  
  1. [root@mysql ~]# tail -1 /etc/profile  
  2. export TMOUT=600  
  3. [root@mysql ~]# source /etc/profile  

7.控制历史命令记录数,历史命令文件路径:~/.bash_history

 

  1. [root@mysql ~]# echo "export HISTSIZE=20" >> /etc/profile  
  2. [root@mysql ~]# echo "export HISTFILESIZE=20" >> /etc/profile  
  3. [root@mysql ~]# tail -2 /etc/profile  
  4. export HISTSIZE=20  
  5. export HISTFILESIZE=20  
  6. [root@mysql ~]# source /etc/profile 

 

posted @ 2015-09-25 14:45  chenshoubiao  阅读(428)  评论(0编辑  收藏  举报