关闭系统不必要的端口,增强系统安全,此处以关闭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.

实际操作截屏

关闭其他端口

最新文章

  1. Linux系统性能统计工具Sar和实时系统性能监控脚本
  2. 学习笔记--(平衡树)splay
  3. Loadrunner 接口测试的两种方法
  4. C++学习34 模板类
  5. wikioi 1154 能量项链
  6. The MySQL C API 编程实例
  7. 闪存主控IC的作用
  8. 与众不同 windows phone (8) - Tile(磁贴)
  9. Git - error: RPC failed; result=22, HTTP code = 401 fatal: The remote end hung up unexpectedly
  10. 【疑问】用python写登录验证遇到的问题
  11. [转载] su和sudo
  12. C# Math的说有函数 以及说明
  13. zTree动态初始化树形结构加载
  14. META-INF文件夹中的MANIFEST.MF 的作用
  15. excel 中怎么让两列姓名相同排序(转)
  16. gitignore有时候为啥过滤不了文件或目录
  17. RabbitMQ fanout类型的Exchange
  18. MyBatis批量更新for Mysql 实例
  19. ARC下的block导致的循环引用问题解析
  20. 常用的JVM配置参数

热门文章

  1. P1079Vigenère密码
  2. [BZOJ 3509] [CodeChef] COUNTARI (FFT+分块)
  3. E - 盒子游戏
  4. PY个欧拉筛
  5. activemq热备与消息丢失
  6. jdk8中几个核心的函数式接口笔记
  7. Trait讲解
  8. Python 操作sqlite数据库及保存查询numpy类型数据(二)
  9. 【学习】022 ActiveMQ
  10. 用doxygen+graphviz生成函数调用流程图