smb.conf Add Group Script">

Contents


On-line Guides
All Guides
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems

How To Guides
Xen Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

 

 

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 smbgrpadd.sh. 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.

Example11.1.smbgrpadd.sh

#!/bin/bash

# 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

[global]
add group script = /path_to_tool/smbgrpadd.sh "%g"

Samba HowTo Guide
Prev Home Next

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