macos排查并禁用系统占用的8021端口

简介: macos排查并禁用系统占用的8021端口


不要为了尖锐的批评而生气,真理总是不合口味的。——高尔基

本地启动服务一直报错

Description:
Web server failed to start. Port 8021 was already in use.
Action:
Identify and stop the process that's listening on port 8021 or configure this application to listen on another port.

然后一查

# 扫描端口占用
GithubIireAchao:blog achao$ sudo lsof -i :8021
Password:
COMMAND PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
launchd   1 root   40u  IPv4 0xe1fc8d3044233469      0t0  TCP localhost:intu-ec-client (LISTEN)
launchd   1 root   41u  IPv6 0xe1fc8d26b1acd419      0t0  TCP localhost:intu-ec-client (LISTEN)
launchd   1 root   42u  IPv4 0xe1fc8d3044233469      0t0  TCP localhost:intu-ec-client (LISTEN)
launchd   1 root   43u  IPv6 0xe1fc8d26b1acd419      0t0  TCP localhost:intu-ec-client (LISTEN)

发现占用的PID1,即系统的 launchd 进程

因为launchd 进程会根据所在的 /Library/LaunchDaemons/Library/LaunchAgents 目录中的配置文件来管理各个服务或应用,扫描文件找到服务,当然这个目录也可能是/System/Library/LaunchAgents/System/Library/LaunchDaemons

GithubIireAchao:LaunchAgents achao$ grep -rl "intu" /Library/LaunchAgents
GithubIireAchao:LaunchAgents achao$ grep -rl "intu" /Library/LaunchDaemons
GithubIireAchao:LaunchDaemons achao$ grep -rl "8021" /System/Library/LaunchAgents
# 找到了包含8021的服务列表
GithubIireAchao:LaunchDaemons achao$ grep -rl "8021" /System/Library/LaunchDaemons
/System/Library/LaunchDaemons/com.apple.airportd.plist
/System/Library/LaunchDaemons/com.apple.eapolcfg_auth.plist
/System/Library/LaunchDaemons/com.apple.ftp-proxy.plist

可以挨个查看,也可以再次筛选,例如使用">8021<"等来筛选

GithubIireAchao:LaunchDaemons achao$ grep -rl "<string>8021</string>" /System/Library/LaunchDaemons
/System/Library/LaunchDaemons/com.apple.ftp-proxy.plist

卸载这个服务,-w表示写入配置,这里整体是禁止下次启动

GithubIireAchao:LaunchDaemons achao$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ftp-proxy.plist

再次查看端口

GithubIireAchao:LaunchDaemons achao$ sudo lsof -i :8021
GithubIireAchao:LaunchDaemons achao$


相关文章
|
17天前
|
Ubuntu 网络安全
百度搜索:蓝易云【ubuntu系统ufw开放端口教程】
现在,你已经成功在Ubuntu系统中使用ufw开放了指定的端口。请确保只开放必要的端口,并注意网络安全。
151 3
|
17天前
|
安全 Linux 网络安全
百度搜索:蓝易云【centos7系统添加用户、密码,以及修改端口教程】
请牢记,对系统进行任何更改都需要谨慎行事。在执行这些操作之前,最好备份重要的数据和配置文件,并确保您具有足够的权限和知识来进行这些更改。如果在操作过程中遇到任何问题,请务必小心并及时修复,以免影响系统的稳定性和安全性。
78 2
|
17天前
|
Linux 网络安全
Linux - firewall-cmd 命令添加端口规则不生效排查
Linux - firewall-cmd 命令添加端口规则不生效排查
219 0
|
17天前
|
网络协议 Linux 网络安全
百度搜索:蓝易云【iptables-nvL查看linux系统的所有ip和端口情况教程。】
请注意,使用iptables需要具有管理员权限。如果你没有权限或遇到问题,请以管理员身份运行命令或联系系统管理员寻求帮助。
125 0
|
7月前
|
Linux 应用服务中间件 nginx
centos 80端口被占用排查+解决
centos 80端口被占用排查+解决
457 0
|
9月前
|
网络协议 安全 Linux
百度搜索:蓝易云【Linux系统下如何在防火墙开放指定端口】
在Linux系统中,防火墙是用于保护计算机安全的重要组成部分。默认情况下,大多数Linux发行版都会自带一个防火墙,如iptables、firewalld等。当我们需要运行特定的应用程序或服务时,需要在防火墙中开放相应的端口。下面就是Linux系统下如何在防火墙开放指定端口的详细步骤。
87 0
|
12月前
|
安全 Linux 网络安全
【超详细】Linux系统修改SSH端口教程
在linux中,默认的SSH端口号为22,由于这是咱们都知道的端口号,一旦有入侵者进行端口扫描的时候扫描出22端口,就立马知道这是进行SSH登录的端口号,因而咱们需要修改默认的端口号。
4727 1
【超详细】Linux系统修改SSH端口教程
|
17天前
|
弹性计算 Shell Linux
|
8月前
|
Windows
windows系统 如何查看端口占用情况并关闭占用的进程?
windows系统 如何查看端口占用情况并关闭占用的进程?
242 0
|
17天前
|
Ubuntu Linux iOS开发
各系统查看端口占用并停止
各系统查看端口占用并停止
30 1
http://www.vxiaotou.com