Linux folder permissions

In my office we have a network directory structure:

/jobs/2004/3999-job_name/...
/jobs/2004/4000-job_name/...

The problem is that employees are renaming the folders "4000-job_name" (which, in turn, break other things, which depend on the name that is consistent with the database).

How can I prevent users from renaming the parent folder while still allowing them full control over the contents of this folder?

Please keep in mind that this is a Samba share that Windows users will access.

+3
source share
3 answers

I think you want to do this:

chmod a=rx /jobs     #chdir and lsdir allowed, modifying not
chmod a=rwx /jobs/*  #allow everything to everyone in the subdirectories

/jobs/* /jobs, /jobs. /jobs/ - .

, rwx .

( , - , - SO)

+6

, : "" "". , 99% Unix . : Unix , .


EDIT: , , . , , , . , , . , , . .

, OTOH, . [, , Unix: , .] ( , ). [ Unix hardlinks.] , , . (, , , ), , . . , , , - , , . [ syscall/library unlink, delete: , ; " ", .]

, Unix . Unix, , - " A B, ?" , . , - , , , . , : , , !

+3

-/jobs/2004/- , .

, :

ndogg@seriallain:/tmp$ sudo mkdir jobs
ndogg@seriallain:/tmp$ sudo mkdir jobs/2004
ndogg@seriallain:/tmp$ sudo mkdir jobs/2004/3999-job_name/
ndogg@seriallain:/tmp$ cd jobs/2004/
ndogg@seriallain:/tmp/jobs/2004$ sudo chown ndogg.ndogg 3999-job_name/
ndogg@seriallain:/tmp/jobs/2004$ ls -alh
total 12K
drwxr-xr-x 3 root  root  4.0K 2009-03-13 18:23 .
drwxr-xr-x 3 root  root  4.0K 2009-03-13 18:23 ..
drwxr-xr-x 2 ndogg ndogg 4.0K 2009-03-13 18:23 3999-job_name
ndogg@seriallain:/tmp/jobs/2004$ touch 3999-job_name/foo
ndogg@seriallain:/tmp/jobs/2004$ mv 3999-job_name/ blah
mv: cannot move `3999-job_name/' to `blah': Permission denied
+2

Source: https://habr.com/ru/post/1704728/


All Articles