当前位置 主页 > 服务器问题 > Linux/apache问题 >

    教你如何搭建一个安全的Linux服务器教程(3)

    栏目:Linux/apache问题 时间:2018-09-25 13:49



      第一步:把文件的权限限改成600。

      [root@deep]# chmod 600 /etc/inetd.conf

      第二步:确信文件的所有者是root。

      [root@deep]# stat /etc/inetd.conf

      第三步:编辑“inetd.conf”文件(vi /etc/inetd.conf),禁止所有不需要的服务,如:ftp、 telnet、 shell、 login、 exec、talk、ntalk、 imap、 pop-2、pop-3、finger、auth,等等。如果你觉得某些服务有用,可以不禁止这些服务。但是,把这些服务禁止掉,系统受攻击的可能性就会小很多。改变后的“inetd.conf”文件的内容如下面所示:

    # To re-read this file after changes, just do a 'killall -HUP inetd'##echo stream tcp nowait root internal#echo dgram udp wait root internal#discard stream tcp nowait root internal#discard dgram udp wait root internal#daytime stream tcp nowait root internal#daytime dgram udp wait root internal#chargen stream tcp nowait root internal#chargen dgram udp wait root internal#time stream tcp nowait root internal#time dgram udp wait root internal## These are standard services.##ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd## Shell, login, exec, comsat and talk are BSD protocols.