Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a directory on a linux server, where my user owns all the files, and only a certain directory is world-writable. All other directories are read-only for guests. The idea is that anyone should be able to do anything they want inside the world-writable directory, but there's one problem: I can't alter guest-created files with my own UNIX user afterwards.

I just can't figure out what kind of UNIX permissions and/or samba settings would allow the same kind of behavior that I have in a similarly configured windows share. On the windows machine, I can set the world-writable directory on the share to have write permissions for "Everyone", and everyone can then do anything they want inside that directory, locally or by accessing the share as a guest. How do I get this same functionality on the linux server? Currently files written by guests can only be altered by UNIX users nobody and root.

Here is my smb.conf:

[global]
unix charset = iso8859-15
interfaces = 192.168.0.1
bind interfaces only = yes
socket address = 192.168.0.1
name resolve order = host
read only = no
max open files = 32768
csc policy = disable
load printers = no
syslog = 0
map to guest = Bad user # This is horrible :)

[homes]
browseable = no
create mask = 0600
security mask = 0600
directory mask = 0700
directory security mask = 0700

[problem_share]
path = /storage
public = yes
create mask = 0644
security mask = 0644
directory mask = 0755
directory security mask = 0755
hide dot files = no

I have tried using default ACLs, but that didn't seem to help. Those have been very helpful in many other situations, but samba has so many permissions settings that seem to interfere somehow.

share|improve this question

3 Answers 3

grs is right about the files.

[problem_share]
path = /storage
public = yes
create mask = 0666 #(everybody: read+write)
security mask = 0666 #(everybody: read+write)
directory mask = 0777 #(everybody: list+modify+traverse)
directory security mask = 0777 #(everybody: list+modify+traverse)
hide dot files = no

You may want improve your understanding of Traditional Unix Permissions.

share|improve this answer

You need to fix [problem_share] create mask = 0666. More info: here.

share|improve this answer

I realize that my initial question was very poorly presented, and I deserved those newbie answers. But here's how I finally solved this problem:

I made all directories in /storage owned by my own UNIX user, with read-only permissions for others. Then I mounted /storage/upload on top of itself using FUSE bindfs "mirror" option. The exact command line is "bindfs --mirror=@staff,@users,nobody --create-for-user=myuser /storage/upload /storage/upload". Now user nobody, and users in the groups staff & users see the files in /storage/upload as their own, and can modify them as they see fit. But actually, all files are owned by my own UNIX user, and if I move a file outside of that directory, no other user can modify it anymore, it becomes read-only for them. This is a very clean solution IMO, and isn't tied to samba at all.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.