centos7关闭不必要的服务和端口


云服务器开启很多不必要的端口,造成安全隐患

TCP

25端口:邮件服务

systemctl stop postfix

53端口 :域名解析服务

systemctl stop rhel-domainname

111端口:SUN公司的RPC服务所有端口

systemctl stop rpcbind
systemctl stop rpcbind.socket
systemctl stop rpcbind.target

631端口:打印服务

systemctl stop cups

UDP

5353端口:多播DNS(multicastDNS)/DNS-SD网络服务

systemctl stop avahi-daemon
systemctl stop avahi-daemon.socket

查看端口命令:

grep 端口号 /etc/services|head

一键停止禁用:

ss -ntlp
systemctl stop rhel-domainname
systemctl stop cups
systemctl stop rpcbind
systemctl stop rpcbind.socket
systemctl stop rpcbind.target
systemctl stop dnsmasq
systemctl stop postfix
systemctl stop avahi-daemon
systemctl stop avahi-daemon.socket
ifconfig virbr0 down
brctl delbr virbr0 systemctl disable rpcbind systemctl disable rpcbind.socket systemctl disable rpcbind.target systemctl disable cups systemctl disable dnsmasq systemctl disable rhel
-domainname systemctl disable postfix
systemctl disable avahi-daemon
systemctl disable avahi-daemon.socket
systemctl disable libvirtd
ss -ntlp
exit

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM