smb.conf Add Group Script">
Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Samba HowTo Guide
Prev Home Next

Sample smb.conf Add Group Script

A script to create complying group names for use by the Samba group interfaces is provided in This script adds a temporary entry in the /etc/group file and then renames it to the desired name. This is an example of a method to get around operating system maintenance tool limitations such as those present in some version of the groupadd tool.


# Add the group using normal system groupadd tool.
groupadd smbtmpgrp00

thegid=`cat /etc/group | grep ^smbtmpgrp00 | cut -d ":" -f3`

# Now change the name to what we want for the MS Windows networking end
cp /etc/group /etc/group.bak
cat /etc/group.bak | sed "s/^smbtmpgrp00/$1/g" > /etc/group
rm /etc/group.bak

# Now return the GID as would normally happen.
echo $thegid
exit 0

The smb.conf entry for the above script shown in the configuration of smb.conf for the add group Script demonstrates how it may be used.

Example11.2.Configuration of smb.conf for the add group Script

add group script = /path_to_tool/ "%g"

Samba HowTo Guide
Prev Home Next

  Published under the terms fo the GNU General Public License Design by Interspire