2

I have an Ubuntu file server (samba) sharing a folder structure with a Windows 7 computer classroom. All users use the same user/pass to access the folders and have read/write permissions.

I would like to prevent users from moving or deleting folders, but keep the file permissions. In other words, I would like to protect my folder structure, but allow users to add/delete/rename/move files within that structure.

How can I do that?

1
  • All the users use the same username/password? If so it's not going to be possible
    – slm
    Jan 2, 2014 at 14:24

2 Answers 2

1

If you only have one level of directories, it should be possible. The key is that creating/removing files depends on the write-ability of the directory those files are in. So imagine this structure:

/srv/             root:files   drwxr-x---
/srv/userfiles/   root:files   drwxrwx---

(files is the group of the user that accesses the system) In this case users can see the contents of /srv, but they can't move/remove userfiles/. They can create/modify/remove anything in userfiles/. This method breaks down if you need a tree directories more than one layer deep that can't be moved.

1
  • thank you for your answer, in my case i do have a tree of directories under /userfiles. any solution for my problem?
    – buntuser
    Jan 5, 2014 at 7:02
0

There's no pushbutton for this, but it's not hard to script, set up an inotifywait monitor and undo any unwanted changes.

The payload command is

inotifywait -mr -e move -e create -e delete -e attrib \
        --format '%e %w%f/' /srv/userfiles

to see everything done to the structure, it'll print lines like

CREATE,ISDIR /srv/userfiles/haha/

and you pipe the output through a scanner for the stuff that needs to get undone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .