Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to edit "smb.conf"

Hi there,
i would like to share some folders directly from the smb.conf
I am able to do that with Linux, but i my Mac i can't find this file!
Anyone can help me?

Other question is:
where mac os puts the sharing folder settings when you edit the system preferences?

Thanks
Filippo

MacBook Pro 5.5, Mac OS X (10.6.6)

Posted on Jan 29, 2011 9:43 AM

Reply
14 replies
Sort By: 

Jan 29, 2011 10:52 AM in response to filippo1982

The file is here:

/etc/smb.conf


If you're not sure where a file is located, the find command is typical, or you can use Spotlight from the command line:


$ find / -iname smb.conf -print
...
$ mdfind -name smb.conf
...
/private/etc/smb.conf.template
/private/etc/smb.conf
...
$ 


Mac has /etc linked over into /private, as you'll discover. (This is implemented such that going after /etc directly does work correctly.)

Off the top, I don't recall the details of the plists the Server Admin settings; it's typical to use the command-line serveradmin tool for that purpose. And using the provides tools is an approach which avoids derailing the command-line serveradmin and Server Admin GUI tools through an errant edit. Issue +man serveradmin+ for details.

As for technical resources, the File Server Administration, Introduction to the Command Line manuals are in the [documentation set|http://www.apple.com/server/macosx/resources/documentation.html], and will provide details on the typical Apple approach. (Carrying over Linux norms for directly accessing configuration files can sometimes lead to operational problems, too. There are various discussions of this around, including [TS3144|http://support.apple.com/kb/TS3144].)
Reply

Jan 29, 2011 11:17 AM in response to MrHoffman

Thank you for your quick answer!
Now i can see the smb.conf but i can't edit it with:

sudo open -a /Applications/TextEdit.app /etc/smb.conf

So Mac os saves the sharing folder settings in a .plist file in /Users/TechnoPhil/Library/Preferences?

Message was edited by: filippo1982
Reply

Jan 29, 2011 12:04 PM in response to filippo1982

Text-editing options:

sudo nano /etc/smb.conf
sudo vim /etc/smb.conf
sudo emacs /etc/smb.conf


I'd create a copy first, particularly if you don't have a full backup of your disk.

sudo cp /etc/smb.conf /etc/smb.conf-save


If you're just getting going with a shell text editor, then you'll probably want to use nano and then work your way to vim or emacs or (if you prefer a GUI editor) have a look at textwrangler and its text-mode capabilities, or at macvim and its GUI interface.

Using many of the GUI-facing editors and saving out RTF files and other such (and text files can be encoded in many different ways) can lead to configuration file corruptions and problems with tools or even with booting the operating system.

Using Textedit.app is a common way to corrupt Unix-layer files, too.

So Mac os saves the sharing folder settings in a .plist file in /Users/TechnoPhil/Library/Preferences?


Off-hand, I haven't needed to look at the details of the implementations underneath the serveradmin tool and Server Admin in this area.

And FWIW, I would not expect to see the server-wide share settings in /User. I'd expect to see those over in /Library. The [file and directory structures used by Mac OS X|http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFil eSystem/BPFileSystem.html] are a superset of those found on Unix and POSIX platforms.

Mac OS X and Mac OS X Server make heavy use of plist files, yes. This is tied into the plutil tool, as well as the defaults command, and at various tools that are part of Xcode including Property List Editor.app and such.

If you're coming over from Linux and want to know more about the platforms, then read the manuals end-to-end for a high-level introduction to the norms and expectations, and then have a look at Amit Singh's Mac OS X Internals book, then start Googling around for details and procedures.

It can also help if you make an effort to forget a whole lot of what you know about Linux administration, particularly around how management is based on editing command files. Mac OS X works differently, and is managed entirely differently than Linux.

Put another way, you look likely to be headed for a learning experience here. Have fun, but definitely have a backup first.

Shell commands are unforgiving of errors. Shell commands with sudo are particularly unforgiving. Have a backup. Or three.
Reply

Jan 30, 2011 3:20 AM in response to MrHoffman

Sorry but my english is poor and i can't undestand exactly what you mean!
Anyway if i edit smb.conf i have to activate the sharing folder settings in mac system preferences, in order to see what i shared in smb.conf!
Why?

Also i have to activate the guest account (only sharing).

In linux you can do all of that simply editing the smb.conf and crate the sharing folders, for example:

[[test]]

comment = test
path = /Users/usernameaccount/Desktop/test
writeable = yes
guest ok = yes


Thank you.

Best regads
Filippo
Reply

Jan 30, 2011 4:55 AM in response to filippo1982

Anyway if i edit smb.conf i have to activate the sharing folder settings in mac system preferences, in order to see what i shared in smb.conf!


If you edit configuration files directly, you will cause yourself problems.

¿Habla usted español? Esto no es de linux. Modificaciones directas no son recomendables. Se dañará los datos.

Also i have to activate the guest account (only sharing).


Launch Server Admin > select your server and authenticate > SMB > Settings > Access > enable Guest Access

In linux you can do all of that simply editing the smb.conf and crate the sharing folders, for example:


Again, you are not using Linux. If you assume that you are managing a Linux system, then you will corrupt the data files that the management tools use, and the tools will no longer work, or will no longer work reliably.

Sharing and sharepoints are also configured and enabled with the Server Admin tool.
Reply

Jan 30, 2011 8:09 AM in response to filippo1982

And I now realize you're running Mac OS X client. And not Mac OS X Server, as I had (incorrectly) assumed. Which means the directions I've provided above are wrong.

To set up file sharing for CIFS/SMB/Samba and AFP on Mac OS X client, launch System Preferences, select Sharing, and select File Services, set up your shares, and enable file services. You can control both services, but Mac OS X client will start both by default.

It's still ill-advised to edit the configuration files directly where there's a GUI or a command interface.

A little Spanish and a little German (both badly), but no Italian. Ah, well.
Reply

Jan 30, 2011 2:33 PM in response to filippo1982

But do you think that is really impossible to set up a sharing files configuration directly with smb.conf?


This is your computer. Do whatever you want.

I would not recommend this approach. I'd use System Preferences.

On the other hands i found Server Administration Tools: http://support.apple.com/kb/DL1071
Can i use them?


Those tools are for Mac OS X Server. If you do not have Mac OS X Server here, then those tools do not apply to your system.
Reply

Jan 30, 2011 3:05 PM in response to filippo1982

One way to find out where the smb.conf file is located. regardless of the O/S that
you're using:

smbd -b | grep 'smb.conf'

This will tell you where the file is, unless the smbd was started up with the '-s' option.
In which case check the output of ps(1).

Also, after modifying the file, run testparm(1). To check that there are no syntax errors in the file.

Message was edited by: Nils C. Anderson
Reply

Jan 30, 2011 11:07 PM in response to Nils C. Anderson

@ MrHoffman

Thanks you.

@ Nils C. Anderson

We know wher the smb.conf is, this is mine for example:

******************************************************************************** ******************; Configuration file for the Samba software suite.
; ==============================================================
;
; For the format of this file and comprehensive descriptions of all the
; configuration option, please refer to the man page for smb.conf(5).
;
; The following configuration should suit most systems for basic usage and
; initial testing. It gives all clients access to their home directories and
; allows access to all printers specified in /etc/printcap.

; BEGIN required configuration

; Parameters inside the required configuration block should not be altered.
; They may be changed at any time by upgrades or other automated processes.
;
; Site-specific customizations will only be preserved if they are done
; outside this block. If you choose to make customizations, it is your
; own responsibility to verify that they work correctly with the supported
; configuration tools.

[[global]]
debug pid = yes
log level = 1
server string = Mac OS X

; ************************

; "include = /var/db/smb.conf" più sotto!

netbios name = TechnoPhil
server string = TechnoPhil
; ************************

printcap name = cups
printing = cups

encrypt passwords = yes
use spnego = yes

passdb backend = odsam

idmap domains = default
idmap config default: default = yes
idmap config default: backend = odsam
idmap alloc backend = odsam
idmap negative cache time = 5

map to guest = Bad User
guest account = nobody

unix charset = UTF-8
display charset = UTF-8
dos charset = 437

vfs objects = notify kqueue,darwinacl,darwinstreams

; Don't become a master browser unless absolutely necessary.
os level = 2
domain master = no

; For performance reasons, set the transmit buffer size
; to the maximum and enable sendfile support.
max xmit = 131072
use sendfile = yes

mangled names = no
stat cache = no
wide links = no

; The darwin_streams module gives us named streams support.
stream support = yes
ea support = yes

; Enable locking coherency with AFP.
darwin_streams:brlm = yes

; Core files are invariably disabled system-wide, but attempting to
; dump core will trigger a crash report, so we still want to try.
enable core files = yes

; Filter inaccessible shares from the browse list.
com.apple:filter shares by access = yes

; Check in with PAM to enforce SACL access policy.
obey pam restrictions = yes

; Make sure that we resolve unqualified names as NetBIOS before DNS.
name resolve order = lmhosts wins bcast host

; Pull in system-wide preference settings. These are managed
; by smb-sync-preferences.

; ripristinare questa riga per collegarsi con l'utente pc remoto
; include = /var/db/smb.conf

; Pull in system share configuration. These are managed
; by smb-sync-shares.
include = /var/db/samba/smb.shares

[[printers]]
comment = All Printers
path = /tmp
printable = yes
guest ok = no
create mode = 0700
writeable = no
browseable = no

; prove mie!

;[[prova]]
; comment = prova
; path = /Users/TechnoPhil/Desktop/prova
; writeable = yes
; guest ok = yes

; Site-specific parameters can be added below this comment.
; END required configuration.
******************************************************************************** ******************

I can edit it and it works perfectly, but the problem is that i have to activate the sharing folder settings in mac system preferences, in order to see what i shared in smb.conf! Also i have to activate the guest account (only sharing).

To solve this problem we could know how Macintosh manages all the sharing preference!
I am shure that one thing is use the system preferences to create a sharing folder, other is config the smb.conf (there are 2 different way to do the same thing)!

Thank you
Filippo
Reply

How to edit "smb.conf"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.