Re: Directory permissions

Paul Mc Auley <[email protected]> Mon, 10 Apr 2017 22:22:49 +0100
Newsgroups gmane.user-groups.linux.ilug.general
Message-ID <CADuf5h=V4PcqWZp+p6joSFPRp9s0=rBu+egMiAQ+mB1VTiL7YQ@mail.gmail.com>
So, directory permissions are just that they effect the ability to
make changes to the list of files in the directory. If there is a
directory with existing files but and no write access available to the
user on the directory itself, the user can change the file but not the
directory's representation of that file.
For example:

$ mkdir foo
$ cd foo
$ touch hello.txt
$ sudo chown root .

Now, unless you have some unusual umasks you are in a directory which
you don't own and don't have write access to, which contains a file
you do own and have write access to.
You can change that file's contents (because that's a property of the
file). But you can't rename it, because that's a property of the
directory.

There are things you can do with sticky bits, setattr or selinux
contexts too but that's rapidly getting to the point where you have
problems maintaining the whole thing in a matter that's easily
understood by (say) a new member of staff and as such is out of scope.

This means that your userbase could edit files (assuming write access
to the files on a group basis), but can neither remove nor create new
files. It may also break anything which attempts to write the files as
a temp name and move them into place. That said, you could have
per-user or sub-group directories where you apply different permission
models.

The _other_ answer (which is also out of scope) is "don't do it that
way", it sounds like the sort of scenario where you should be using
change control in some form, check out a copy, make changes, check
them in. Roll back when something goes sour, trial by combat for merge
conflicts.

Paul

On 10 April 2017 at 17:07, Kevin Philp <[email protected]> wrote:
> At work we have a lot of files shared over nfs4. Our users need read/write
> access to the shared directory. Today one of our users accidently deleted a
> major sub directory on a project containing hundreds of files. We recovered
> all the files and they are backed up but it was a nuisance. So how do I
> provide rw access to a group working on files in a directory but stop them
> moving or deleting the whole directory?
>
> If I set the permissions rwxr-x--- they can't make new files in the
> directory
>
> If I set the permissions rwxrwx--- they can delete the directory
>
> Any suggestions welcome
>
> Kevin.
>
> --
> Irish Linux Users Group
> ---
> You received this message because you are subscribed to the Google Groups
> "ILUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/a/linux.ie/group/ilug/.
> To view this discussion on the web, visit
> https://groups.google.com/a/linux.ie/d/msgid/ilug/86c78288-21cd-4d1f-9933-b8851edb5cd8%40linux.ie.

-- 
Irish Linux Users Group
--- 
You received this message because you are subscribed to the Google Groups "ILUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send an email to [email protected].
Visit this group at https://groups.google.com/a/linux.ie/group/ilug/.
To view this discussion on the web, visit https://groups.google.com/a/linux.ie/d/msgid/ilug/CADuf5h%3DV4PcqWZp%2Bp6joSFPRp9s0%3DrBu%2BegMiAQ%2BmB1VTiL7YQ%40mail.gmail.com.