Turn Off SMB File Sharing

Stop the smbd daemon so this Mac stops offering file sharing over the network.

macOSlaunchctlsmbsecurityMedium risk
Run `sudo launchctl disable system/com.apple.smbd && sudo launchctl bootout system/com.apple.smbd` to switch SMB sharing off.

01Command

Command
$ sudo launchctl disable system/com.apple.smbd && sudo launchctl bootout system/com.apple.smbd

02What it does

File sharing is off by default, but it is often switched on years ago and forgotten — smbd then listens on the network wherever the Mac goes, from cafes to shared offices. Disabling the daemon removes that listening port; System Settings > General > Sharing > File Sharing is the GUI equivalent. The undo commands re-enable and start it again.

03Risk

RiskMedium risk
RequirementsAdministrator access (sudo)
!Warning: If you do use file sharing on this Mac, leave it on and instead make sure the shared folders and account permissions are restricted.

04Undo

Undo
$ sudo launchctl enable system/com.apple.smbd && sudo launchctl kickstart -k system/com.apple.smbd

05Sources

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions