Folder Permissions

Christopher Kranz clk at CS.Princeton.EDU
Sat Sep 13 17:29:50 GMT 1997

Maung, Than wrote:
> I'm trying to set up a public folder on my SAMBA server which will let
> my users create their own folders to store their files.
> And not let everyone delete them.

I ended up doing something similar but was concerned about name collisions
within the top level.  That is, what happens if two people both want to have a
file or folder called "foo"?

Instead I create a unique share within the public folder (called "scratch")
for each user on the fly.  Here's how I set this up.  First the share

  guest ok = no
  path = /scratch/%u
  read only = no
  root preexec = /var/local/etc/scratch.preexec %u %g

The scratch.preexec script makes sure that /scratch/%u exists and sets the
correct ownership permissions.  Here's what the script looks like:


exec >> /dev/null 2>&1


umask 22

if [ ! -d /scratch/${ntuser} ]
  mkdir /scratch/${ntuser}
  chown ${ntuser}:${group} /scratch/${ntuser}

exit 0

The only drawback in this scheme is that users can not easily access each
other's scratch files.  I hope this helps.

	Christopher Kranz
	clk at
   Christopher Kranz        |   Systems Programmer   | clk at CS.Princeton.EDU
   35 Olden St., Room 211   | Computer Science Dept. | Voice: 609-258-1747
   Princeton, NJ 08544-2087 |  Princeton University  |   FAX: 609-258-1771
   ==========================PGP V2.6.2 key available=======================

More information about the samba mailing list