不求甚解

此博客为个人学习之用,如与其他作品雷同,纯属巧合。

导航

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

Posted on 2021-10-28 16:05  三年三班王小朋  阅读(2636)  评论(0编辑  收藏  举报

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

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