Centos安裝後的一些必要處理工作

來源:互聯網
上載者:User

標籤:

1永久關閉selinux,修改成permissive或者disabled(建議),修改完需重啟

2配置network

3.禁止ping(可選,一般不需要禁止)(預設為0位啟用ICMP協議,1為禁止),修改完無須重啟

  1. [[email protected] ipv4]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all  

或者在sysctl.conf中添加

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

(可選)登陸後顯示資訊,在""中輸入需要在登陸後顯示的資訊

  1. [[email protected] ~]# echo "It is product environment,be careful..." > /etc/motd  

5.修改預設ssh設定,增加系統安全性
備份sshd_config檔案

 [[email protected] 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秒自動斷開

  

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

7.控制曆史命令記錄數,曆史命令檔案路徑:~/.bash_history

 

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

 

Centos安裝後的一些必要處理工作

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.