The workgroup name and server description are configured at the top of the global section:
[global]
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup =
# server string is the equivalent of the NT Description field
server string =
Set the workgroup name to the value used by the local Windows workgroup or domain. The server string description can be any descriptive value (change the default if you don't want people to know you're running a Linux system). The system name will be the same as the hostname.
By default, only home directories and printers will be shared. To add additional shares, add an additional share section to the end of the configuration file. There are many examples in the configuration file, such as this one:
# The following two entries demonstrate how to share a directory so that two
# users can place files there that will be owned by the specific users. In this
# setup, the directory should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many users as required.
;[
; comment =
; path =
; valid users =
; public =
; writable =
; printable =
; create mask =
From this template, you can see the basic format:
[
Name of the share as it will be seen by the Windows systems.
comment =
The description that will appear when browsing the share.
path =
The directory to be shared.
valid users =
Specifies who can access this share: specific users or everyone ( public = yes ). Either valid users or public should be enabled, but not both.
writable =
Determines what can be done with the share. writable controls whether the remote user can change or create files and directories, printable enables printing (not applicable to a regular directory share), and browseable enables the share to appear when the network user is browsing using a tool such as Windows Explorer.
create mask =
Sets the octal permission that is applied to new files.
To allow read-only access to
[doc]
comment = Documentation
path = /usr/share/doc
writeable = no
browseable = yes
guest ok = yes
You will need to adjust the SELinux context of the shared directory (see 'Using SELinux' in Chapter 8 Lab 8.2, 'Using SELinux in Chapter 8).
After editing the configuration file, restart or reload Samba to activate the changes:
# service smb reload
Reloading smb.conf file: [ OK ]
To add Samba users, you must first create a Linux user account (see Lab 4.7, 'Managing Users and Groups '), and then use the
# smbpasswd -a
New SMB password:
Retype new SMB password:
Added user frank.
To change the password, leave out the -a option:
# smbpasswd
New SMB password:
Retype new SMB password:
To delete a user, use the -x option:
# smbpasswd -x
Deleted user kim.