关闭 SMB 文件共享
停用 smbd 服务,让这台 Mac 不再向网络提供文件共享。
运行 `sudo launchctl disable system/com.apple.smbd && sudo launchctl bootout system/com.apple.smbd` 即可关闭。
01命令
命令
$ sudo launchctl disable system/com.apple.smbd && sudo launchctl bootout system/com.apple.smbd02作用说明
文件共享默认是关的,但很多人多年前打开过就忘了——此后 Mac 无论在咖啡厅还是共享办公室,smbd 都在网络上监听端口。停用该服务即可移除这个端口,等效于在系统设置的通用 > 共享里关闭文件共享。撤销命令可随时重新开启。
03风险
!注意: 如果确实需要向其他设备共享文件,请保留开启,并确保共享文件夹和账户权限设置正确。
04撤销
撤销
$ sudo launchctl enable system/com.apple.smbd && sudo launchctl kickstart -k system/com.apple.smbd05来源
- launchctl — manage launch daemons and agents (macOS man page)依据: Documents disable/bootout of system services such as com.apple.smbd, the SMB file-sharing daemon.
最后验证: 2026-09-18 · 分类: 安全与隐私