美文网首页
linux关闭不必要的端口

linux关闭不必要的端口

作者: 082e63dc752b | 来源:发表于2021-04-29 11:42 被阅读0次

关闭系统不必要的端口,增强系统安全,此处以关闭111端口为例进行说明。

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

[root@ ~]# netstat -pantu
Active Internet connections (servers and established)
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      2513/rpcbind        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3259/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2983/master         
tcp6       0      0 :::111                  :::*                    LISTEN      2513/rpcbind        
tcp6       0      0 :::22                   :::*                    LISTEN      3259/sshd           
udp        0      0 0.0.0.0:978             0.0.0.0:*                           2513/rpcbind        
udp        0      0 0.0.0.0:68              0.0.0.0:*                           2744/dhclient       
udp        0      0 0.0.0.0:111             0.0.0.0:*                           2513/rpcbind        
udp        0      0 127.0.0.1:323           0.0.0.0:*                           2539/chronyd        
udp6       0      0 :::978                  :::*                                2513/rpcbind        
udp6       0      0 :::111                  :::*                                2513/rpcbind        
udp6       0      0 ::1:323                 :::*                                2539/chronyd        

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

[root@ ~]# 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@ ~]# systemctl list-unit-files --all | grep port
dbus-org.freedesktop.import1.service          static  
rhel-import-state.service                     enabled 
systemd-importd.service                       static  
[root@ ~]# systemctl list-unit-files --all | grep  rpcbind
rpcbind.service                               enabled 
rpcbind.socket                                enabled 
rpcbind.target                                static  

4)、关闭正在使用111端口的服务,并设置开机不启动该服务

[root@~]# systemctl  stop  rpcbind.socket
[root@~]# systemctl  disable  rpcbind.socket
Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.

相关文章

  • linux关闭不必要的端口

    关闭系统不必要的端口,增强系统安全,此处以关闭111端口为例进行说明。 1)、查看本机正在监听的端口: 2)、查看...

  • linux 打开和关闭端口

    Linux 如何开放端口和关闭端口[https://blog.csdn.net/weixin_37264997/a...

  • 2022-05-19 Linux下启动和关闭nginx命令,

    linux 下面启动nginx 和关闭nginx, 查看linux 开放的所有端口netstat -ntpl,重启...

  • ubuntu关闭不必要的端口

    对于服务器主机漏洞整改,个人建议首先看漏洞所处的端口,如果该端口不是非必须的,建议直接关闭该端口,下面主要说一下如...

  • Linux 查看端口占用及关闭进程

    Linux 查看端口占用及关闭进程 查看端口占用 查看指定端口被哪个进程占用的情况 1、lsof -i:端口号 l...

  • ubuntu 安装并配置samba

    先确认开启相关端口 139 445 关闭防火墙iptables关闭https://linux.cn/artic...

  • Linux 关闭占用端口

    1)查找被占用的端口: abloume@ubuntu:~$ netstat -tln | grep 8000tcp...

  • 安全运维准则手册

    【1】端口回收 ,谨慎开放端口,关闭一切不必要的服务。 【2】权限最小化 ,禁止使用root用户启动服务,日常维护...

  • Apache 操作

    开启 / 关闭 / 重启 Apache 2 Linux下Apache 配置文件位置 修改端口 -修改根目录

  • linux系统关闭端口方法

    1、通过杀掉进程的方法来关闭端口每个端口都有一个守护进程,kill掉这个守护进程就可以了 每个端口都是一个进程占用...

网友评论

      本文标题:linux关闭不必要的端口

      本文链接:https://www.haomeiwen.com/subject/lpairltx.html