Skip to main content
Solved

Mountain Lion File Sharing via Terminal

  • September 6, 2012
  • 10 replies
  • 28 views

Forum|alt.badge.img+3

Hey Guys,

Probably a dumb question - but was looking for a way to enable File Sharing (both AFP and SMB) consistently for Mountain Lion via a script or terminal (or config profile, any method that would turn it on). I know the Resource Kit contains a script, but it doesn't seem to enable the LaunchDaemon without the -F flag which I believe would need to happen at each login.

I tried changing the Disabled key to false within the com.apple.AppleFileServer.plist but that didn't seem to stick.

Probably over-thinking this.

Thanks for any suggestions!

Best answer by talkingmoose

Just realized you were speaking about modifying the "Disabled" key. No need to do that. Add the "-w" flag to your command. It's purpose is to toggle that key:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

or

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

10 replies

Forum|alt.badge.img+18
  • Valued Contributor
  • September 6, 2012

if you change the flag, you will have to load the daemon
launchctl load /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist to start it after you enable it.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • September 6, 2012

Changed the Disabled key to false in com.apple.AppleFileServer.plist and tried launchctl load /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist but I'm receiving the same error I was getting before: "nothing found to load"


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • September 6, 2012

Try unloading first and then loading after that.

Actually, I'd unload, modify and then load just to keep things clean.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • September 6, 2012

Still a no go. I can't unload as there isn't anything to unload (Error unloading, even with a -F). I modified the <key>Disabled</key> from <true/> to <false/> , rebooted, and ran the launchctl load /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist again. Still receiving the same error - "nothing found to load". Is there another file that needs to be modified? Do you have a specific set of instructions I could follow? I've tried monitoring for system changes with Composer but I'm not able to locate anything definitive.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • September 6, 2012

Are you doing the command as sudo?


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • Answer
  • September 6, 2012

Just realized you were speaking about modifying the "Disabled" key. No need to do that. Add the "-w" flag to your command. It's purpose is to toggle that key:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

or

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • September 6, 2012

Awesome! Thanks for the info, I figured it was something easy that I was missing. I'm assuming enabling SMB under file sharing is similar, just call com.apple.smbd instead?


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • September 6, 2012

Appears that works even though it doesn't seem to activate the File Sharing option in System Preferences. Haven't thoroughly tested. This isn't a setting I need to manage in my environment.


Forum|alt.badge.img
  • New Contributor
  • October 31, 2016

Bill Saved the day again!

Thanks Bill.


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • November 1, 2016

@rgibbonz BOBBEEEEEEE!

Oh, geez, like more than four years later you find this? You got your CCT too!