4

I am trying to enable SAMBA (SMB) from terminal.

This enables AFP and File Sharing:

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

But I want enable SMB too from terminal. How can I do that? I need this for MAC OS X (10.5, 10.6, 10.7).

P.S. Same effect if you go to System Preferences->Sharing->File Sharing->SMB (Windows) need to be enabled.

Kazark
  • 3,419
  • 3
  • 26
  • 35
User1234
  • 247
  • 3
  • 4
  • 11
  • I'm quite sure you could somehow record an Automator action workflow thingie for this and run it. EDIT: Ignore that, you want to do it from the terminal. – Tristan Oct 23 '11 at 19:48

2 Answers2

3

If you run the following:

sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.smbd.plist

The service will launch, although the GUI won't update (as you force loading the service, even if disabled).

You can also remove the Disabled flag from the file and have it load regularly.


You can also run /usr/sbin/smbd directly, as root.

Daniel Beck
  • 109,300
  • 14
  • 287
  • 334
  • Thanks. But first option won't work on Snow Leopard.Couldn't stat("/System/Library/LaunchDaemons/com.appl.smbd.plist"): No such file or directory. – User1234 Oct 24 '11 at 06:07
  • @User1234 You mistyped the file name: `appl` – Daniel Beck Oct 24 '11 at 06:13
  • sorry. here it is Couldn't stat("/System/Library/LaunchDaemons/com.apple.smbd.plist"): But it works for Lion, I guess on Snow Leopard it is ddifferent. It doesn't update UI , but it is avalaible? – User1234 Oct 24 '11 at 06:17
  • I guess on MAC OS X Snow Leopard it is com.apple.smb.server.preferences.plist – User1234 Oct 24 '11 at 06:18
  • It's not working, it's displaying empty , that nothing is shared, when I try to connect from windows. – User1234 Oct 24 '11 at 07:24
  • But when I'm doing it from GUI it works fine, do you have an idea? – User1234 Oct 24 '11 at 07:25
  • @User1234 No, as I don't use SL anymore. Have you tired launching smbd directly? The LaunchDaemon doesn't do anything else anyway. – Daniel Beck Oct 24 '11 at 07:27
  • Yes I tried both. it's just displaying emtpy, no folders.. On Lion it won't work as well.. I need to start something, that GUI does – User1234 Oct 24 '11 at 07:30
1

On Snow Leopard it's /System/Library/LaunchDaemons/smbd.plist

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
ram kumar
  • 11
  • 1