通信人家园

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索

军衔等级:

  新兵

注册:2020-4-17
跳转到指定楼层
1#
发表于 2021-1-12 17:13:42 |只看该作者 |倒序浏览
关闭系统不必要的端口,增强系统安全,此处以关闭111端口为例进行说明。

1)、查看本机正在监听的端口:

[root@b ~]# netstat -tlnup

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 7372/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6929/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 6934/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 7243/master
tcp6 0 0 :::3306 :::* LISTEN 7189/mysqld
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::22 :::* LISTEN 6929/sshd
tcp6 0 0 ::1:631 :::* LISTEN 6934/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 7243/master
udp 0 0 192.168.122.1:53 0.0.0.0:* 7372/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 7372/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 6729/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd
udp 0 0 0.0.0.0:5353 0.0.0.0:* 6246/avahi-daemon:
udp 0 0 127.0.0.1:323 0.0.0.0:* 6267/chronyd
udp 0 0 0.0.0.0:45917 0.0.0.0:* 6246/avahi-daemon:
udp6 0 0 :::111 :::* 1/systemd
udp6 0 0 ::1:323 :::* 6267/chronyd


2)、查看正在监听的111端口,由哪个服务使用

[root@b ~]# cat /etc/services | grep -w 111
sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper TCP
sunrpc 111/udp portmapper rpcbind # RPC 4.0 portmapper UDP


3)、查看使用111端口服务的详细状态信息

[root@b ~]# systemctl list-unit-files --all |grep portmapper
[root@b ~]# systemctl list-unit-files --all |grep rpcbind
rpcbind.service disabled
rpcbind.socket enabled
rpcbind.target static

4)、关闭正在使用111端口的服务,并设置开机不启动该服务
[root@b ~]# systemctl stop rpcbind.socket
[root@b ~]# systemctl disable rpcbind.socket
Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系我们 |网站地图  

GMT+8, 2024-4-30 13:02 , Processed in 0.103149 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部