kmosx2: Samba: Windows File & Printer Sharing

Last modified: Mar 12, 2021 5:01 PM
0 385 Last modified Mar 12, 2021 5:01 PM
Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.


How to modify Samba to enhance Windows File and Printer Sharing

Introduction
Mac OSX 10.2, Jaguar, uses Samba to provide basic Windows File Sharing (SMB) services to PCs or Linux clients. Samba can be configured to provide significant additional capabilities:

- Share any OSX folder other than the default users' Home folder, including folders on other volumes.
- Export Mac printers to Windows (SMB) clients. These printers are then browseable.
- Provide Names Resolution (Name to IP address conversion) using WINS, if none such service exists.
- Take control of Windows master browser elections and potentially improve browsing generally.

This FAQ does not attempt to describe the additional potential capabilities in detail. Those are covered elsewhere. It is intended to be a reference document for "how to modify the Samba configuration file".

An example of a modified Samba file is provided below.

Other FAQs and Knowledge Base Articles are available from the Apple Support site. Some useful links are provided below.

There are four possible approaches to modify the Samba Configuration file. These are discussed below. The first option will suit most users best.

(1) Easiest is to download and install the GUI tool, SSP.
(2) Use TextEdit when logged into OSX as root.
(3) Use a terminal editor such as vi or pico from root or with sudo.
(4) Use the Samba Web Administration Tool (SWAT) logged into OSX as root.

(1) SSP, or Samba Sharing Package, is available for download and install from http://xamba.sourceforge.net/ssp/index.shtmlhttp://xamba.sourceforge.net/ssp/index.shtml. This is the Mac OSX 10.1 and 10.2 site for this package. The GUI is excellent. You need the usual administrative privileges. With the GUI you can easily add other shares to your configuration, share the users Shared folder, enable printing and so on. The GUI makes a backup copy of the default configuration file and provides the ability to have multiple configuration files to support different locations or other requirements.

(2) The easiest non-GUI method is to edit the Samba configuration file with TextEdit. The configuration file is located at /etc/smb.conf. Make sure you make a backup of the file first. Note that Apple provides a backup of the default configuration file at /etc/smb.conf.template. To edit the smb.conf directly, you need to enable the root user and password. The steps required are: enable the root user, log in to OSX as the root user, use the Finder to navigate to the /etc folder and edit the smb.conf file using the TextEdit program.

(3) To use a terminal editor such as pico or vi, you need to log in as root, or use the sudo form of the editing commands.

(4) Apple does not support SWAT in the Jaguar distribution. Perhaps it will in future. This configuration tool is accessed via any web browser at the special address http://127.0.0.1:901/http://127.0.0.1:901/. Additional Samba files and OSX configuration files are required to enable SWAT. The advantage of SWAT is that you have all Samba's configuration parameters available, including detailed help for each one. This is a lot of work for the "ordinary" user, but linux users may be familiar with this tool. See the instructions at the FAQ How to enable Samba's SWAT in OSX 10.2.

After editing your Samba configuration file, you can test it for syntax errors with the testparm terminal command. To activate the new parameter file, go to the System Preferences Sharing control panel and stop and restart Windows File Sharing. After that, you can test the shares are working from the Mac terminal command: "smbclient -NL localhost" or, from a Windows machine, you can run the command: "net view \\macservername". (Substitute the Mac's IP address if you don't have a working DNS or WINS names resolution service).

See the following additional topics:
KB Article 107083: How to set up Windows File Sharing in Mac OSX 10.2
KB Article 106290: About the Root user and How to Enable it
Samba.org Main Site
FAQ: How to enable Samba's SWAT in OSX 10.2
Windows File Sharing - Diagnostic Tools and enhancing your Samba Configuration file which contains a lot more information about the Samba options and more links!!

Example: A fully tested, enhanced, working Samba Configuration File:

This smb.conf file is in actual service and provides:

wins support - the Mac provides names resolution services to all local Windows PCs.
master browsing - force one Mac, especially a permanent PowerMac, to become the Master Browser for your workgroup.
hosts allow - limit Samba access to your Mac from local subnet clients only.
Enable guest access (so Mac User name is not required from Windows client).
Share the Users "Shared" folder (and here, with no guest access).
Add a read only [Music] share on another volumes. This with guest access.
Add [Printers] - export printers to remote windows clients.
- Note however that more steps are required to support printers. In addition to the samba configuration, follow the Mac specific steps (Steps 1, 2 and 3) in Print to Mac OSX 10.2 from Windows using CUPS? then add a network printer to the Windows machine in the usual way. Use any of the pre-installed Apple postscript printer drivers.

In the following, the colored lines are the added ones. The workgroup parameter is also set by the Directory Access utility.

[global]
workgroup = KENWHITE
os level = 65
domain master = true
local master = true
preferred master = true
wins support = yes
hosts allow = 192.168.1. 192.168.0. 10.0.2.

client code page = 437
coding system = utf8
map to guest = bad user

guest account = unknown
encrypt passwords = yes

[homes]
comment = User Home Directories
browseable = no
read only = no
create mode = 0750
[Shared]
comment = add the Shared user folder
path = /Users/Shared
guest ok = no
browseable = yes
read only = no
create mode = 0750
[Music]
comment = links to external drive
path = /volumes/XD1/Music
read only = yes
guest ok = yes
browseable = yes
[Printers]
printable = yes
browseable = no
read only = yes
create mode = 0700
use client driver = yes


Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.
Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.