[Pkg-samba-maint] Bug#443230: Enable net usershare

Mathias Gug mathiaz at ubuntu.com
Wed Sep 19 19:33:33 UTC 2007


Package: samba
Version: 3.0.26a
Tags: patch

I've attached a debdiff that adds net usershare support to samba. It
enables users part of the smbshare group to create shares using the net
usershare command. 

More information about net usershare can me found in the man page of the
net command: 

  Starting  with  version 3.0.23, a Samba server now supports the
  ability for non-root users to add user define shares to be exported
  using  the "net usershare" commands.


This was discussed for Ubuntu here:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/128548

--
Mathias
-------------- next part --------------
diff -u samba-3.0.25b/debian/rules samba-3.0.25b/debian/rules
--- samba-3.0.25b/debian/rules
+++ samba-3.0.25b/debian/rules
@@ -147,6 +147,8 @@
 	install -m 0644 debian/mksmbpasswd.8 $(DESTDIR)/usr/share/man/man8/mksmbpasswd.8
 	install -m 0644 source/nsswitch/libnss_winbind.so $(DESTDIR)/lib/libnss_winbind.so.2
 	install -m 0644 source/nsswitch/libnss_wins.so $(DESTDIR)/lib/libnss_wins.so.2
+	# Create usershare directory
+	install -m 01770 -d $(DESTDIR)/var/lib/samba/usershares
 
 ifeq ($(smbfs),yes)
 	# Create the symlinks that will allow us to do "mount -t smbfs ..."
diff -u samba-3.0.25b/debian/samba-common.postinst samba-3.0.25b/debian/samba-common.postinst
--- samba-3.0.25b/debian/samba-common.postinst
+++ samba-3.0.25b/debian/samba-common.postinst
@@ -113,0 +114,15 @@
+
+case "$1" in
+	configure)
+		# add the smbshare group
+		if ! getent group smbshare > /dev/null 2>&1
+		then
+			addgroup --system smbshare
+		fi
+
+		# update the ownership of /var/lib/samba/usershares
+		chgrp smbshare /var/lib/samba/usershares
+		# update the permissions
+		chmod 01770 /var/lib/samba/usershares
+		;;
+esac
diff -u samba-3.0.25b/debian/smb.conf samba-3.0.25b/debian/smb.conf
--- samba-3.0.25b/debian/smb.conf
+++ samba-3.0.25b/debian/smb.conf
@@ -214,6 +214,15 @@
 ;   winbind enum groups = yes
 ;   winbind enum users = yes
 
+# Setup usershare options to enable non-root user to share folders
+# with the net usershare command.
+
+# The path were the share definition will be stored. Only members of the group
+# owning the path will be able to use the net usershare command.
+   usershare path = /var/lib/samba/usershares
+# Maximum number of usershare. 0 (default) means that usershare is disabled.
+   usershare max shares = 100
+
 #======================= Share Definitions =======================
 
 # Un-comment the following (and tweak the other settings below to suit)
diff -u samba-3.0.25b/debian/samba-common.dirs samba-3.0.25b/debian/samba-common.dirs
--- samba-3.0.25b/debian/samba-common.dirs
+++ samba-3.0.25b/debian/samba-common.dirs
@@ -5,0 +6 @@
+var/lib/samba/usershares


More information about the Pkg-samba-maint mailing list