| Intro | Install | Configure | Troubleshoot | Optimize | PDC | Security |
David Lechnyr <david@lechnyr.com>
Wed, 14 May 2003 11:04:10 -0700
![]()
"How do you power off this machine?" -- Linus Torvalds, when upgrading linux.cs.helsinki.fi, and after using the machine for several months
Samba's configuration file typically resides in /usr/local/samba/lib/smb.conf
or /etc/samba/smb.conf, which you'll need to create initially. If you're unsure
as to where your particular installation of Samba will look for it's smb.conf file, you can
use testparm(1) to inform you where Samba is looking for its smb.conf:
$ testparm Load smb config files from /etc/samba/smb.conf Loaded services file OK. Press enter to see a dump of your service definitions
Edit your smb.conf file and create the following example:
[global]
netbios name = MYSERVER
server string = "Is It Not Nifty?"
workgroup = WORKGROUP
security = share
log file = /var/log/samba.log
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
encrypt passwords = yes
wins support = yes
[public]
path = /tmp
guest ok = yes
writeable = yes
To activate your changes, stop and restart Samba:
# killall smbd nmbd # smbd -D # nmbd -D
From your Windows machine, you should be able to click on Start, then Run, and then type: \\MYSERVER\public
Another popular alternative is Drive Mapping. To map a drive using the Windows GUI, open up either My Computer or Windows Explorer. On the toolbar are many options; look for one that provides a list that includes the words "Map Network Drive". Under Windows XP, this option is under the Tools menu. Once selected, a new box will open up. In the Drive box, click a drive letter that you wish to use (e.g., O:). In the Folder box, type the UNC path for the server and shared resource you wish to connect to:
![]()
Alternately, from a Command Prompt, you can type:
NET USE O: \\MYSERVER\public /YES
In order to mount an SMB share on your Linux machine, regardless of whether or not the share is on a Samba machine, you'll need to prepare a few things. First, you'll need SMB file system support (CONFIG_SMB_FS) in your Linux kernel. If you're running Linux 2.5/2.6, you can experiment with also enabling CIFS support. You can read about both of these filesystems in smbfs.txt (somewhat useless) and cifs.txt in the Linux kernel Documentation/filesystems/ directory.
![]()
In most cases, the mount(8) command requires no additional information about the type of filesystem you are attempting to mount. For a few types however (e.g., nfs, smbfs), additional code is necessary. In the case of mounting smbfs file systems, you need to compile Samba using the --with-smbmount parameter, which will automatically create smbmount(8) and /sbin/mount.smbfs, which is actually just a soft link to smbmount.
Once these two items are in place, you can simply issue something like:
# mount -t smbfs -o username=fred,password=secret //192.168.1.1/public /mnt/public
If you want to use NetBIOS names instead of IP addresses, you'll need to make sure that you have created an lmhosts(5) file in the same directory as your smb.conf file (even if your smb.conf file is empty).
If you don't compile "SMB file system support" into your kernel, you'll get the following error message instead:
mount: fs type smbfs not supported by kernel
A good way to determine what the default values for a particular version of Samba are is to create an empty smb.conf file, run testparm against it and grep for the parameter name you're curious about. For those that just want to get started, here's a quick and dirty (although not secure/optimal) smb.conf to try out that should work under most circumstances (see below).
It's worth noting that you probably won't just set up Samba once and be done with it; instead, you'll find yourself continually modifying the configuration file to meet the ever-changing needs of your multiple clients.
create mode and directory mode tells Samba to use the following permissions to create its files and directories, respectively. See `man chmod` for further details.
dns proxy tells Samba whether or not to try to resolve NetBIOS names via DNS lookups. The default is yes.
encrypt passwords is necessary unless you need to provide support for Windows 95/NT computers. It's recommended that you read ENCRYPTION.txt, WIN95.txt, and WinNT.txt in the Samba documentation. The default is "no", although most people will want to choose "yes"
guest ok tells Samba that the service is open to guests.
guest only tells Samba that the service is only open to guests. The "guest ok" parameter must also be set.
netbios name specifies the NetBIOS name of the Samba server.
security is typically set to "user" under most cases.
wins server, despite its name, tells Samba (nmbd) to act as a WINS client.
wins support tells Samba (nmbd) to act as a WINS server.
writeable informs Samba that the specific service is available for read/write access. The default is "no" (read-only).
workgroup specifies the Domain Name or Workgroup Name.
There are also sample smb.conf configuration files in the examples subdirectory in the distribution. Read them carefully so you can see how the options go together in practice. See the man page for all the options.
Alternately, you can use swat(8) to configure your smb.conf file. SWAT is a web-based interface that helps you configure samba. SWAT might not be available in the samba package on your platform, but in a separate package. Please read the swat man page on compiling, installing and configuring swat from source.
[global]
netbios name = gerbilmaster
[global]
workgroup = fluffygerbils
The default location of the lmhosts file is in the same directory as the smb.conf file. See `man lmhosts`.
Copyright © 2003 David Lechnyr <david@lechnyr.com>
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free
Software Foundation. A copy of the license is available at http://www.gnu.org/licenses/fdl.txt.
| Intro | Install | Configure | Troubleshoot | Optimize | PDC | Security |