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$


相关文章
|
1月前
|
Ubuntu 网络安全
百度搜索:蓝易云【ubuntu系统ufw开放端口教程】
现在,你已经成功在Ubuntu系统中使用ufw开放了指定的端口。请确保只开放必要的端口,并注意网络安全。
162 3
|
1月前
|
安全 Linux 网络安全
百度搜索:蓝易云【centos7系统添加用户、密码,以及修改端口教程】
请牢记,对系统进行任何更改都需要谨慎行事。在执行这些操作之前,最好备份重要的数据和配置文件,并确保您具有足够的权限和知识来进行这些更改。如果在操作过程中遇到任何问题,请务必小心并及时修复,以免影响系统的稳定性和安全性。
86 2
|
1月前
|
Linux 网络安全
Linux - firewall-cmd 命令添加端口规则不生效排查
Linux - firewall-cmd 命令添加端口规则不生效排查
242 0
|
1月前
|
网络协议 Linux 网络安全
百度搜索:蓝易云【iptables-nvL查看linux系统的所有ip和端口情况教程。】
请注意,使用iptables需要具有管理员权限。如果你没有权限或遇到问题,请以管理员身份运行命令或联系系统管理员寻求帮助。
130 0
|
1月前
|
弹性计算 Shell Linux
|
1月前
|
Ubuntu Linux iOS开发
各系统查看端口占用并停止
各系统查看端口占用并停止
39 1
|
6月前
|
Linux 网络安全 Nacos
麒麟v10系统,服务连接nacos提示连接不上9848端口是什么问题呢?服务和nacos都在一台机器,防火墙也都关闭了,telnet9848是ok的,但服务启动时就连不上9848。
麒麟v10系统,服务连接nacos提示连接不上9848端口是什么问题呢?服务和nacos都在一台机器,防火墙也都关闭了,telnet9848是ok的,但服务启动时就连不上9848。
366 1
|
6月前
|
XML 网络协议 安全
主动扫描-Nmap-端口、系统、服务扫描
主动扫描-Nmap-端口、系统、服务扫描
153 0
|
7月前
|
网络协议 前端开发 Java
windows系统下重启springboot项目时,提示端口被占用,却找不到占用端口的程序
windows系统下重启springboot项目时,提示端口被占用,却找不到占用端口的程序
|
4天前
|
Java Android开发
Java Socket编程示例:服务器开启在8080端口监听,接收客户端连接并打印消息。
【6月更文挑战第23天】 Java Socket编程示例:服务器开启在8080端口监听,接收客户端连接并打印消息。客户端连接服务器,发送&quot;Hello, Server!&quot;后关闭。注意Android中需避免主线程进行网络操作。
27 4