Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux folder permissions

Tags:

linux

At my office, we have a network directory structure like this:

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

The issue is that employees rename the "4000-job_name" folders (which in turn breaks other things that rely on the name being consistent with a database).

How can I stop users from renaming the parent folder while still allowing them full control of that folder's contents?

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

like image 604
Matt Darby Avatar asked Dec 08 '25 12:12

Matt Darby


1 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

Since the directories /jobs/* are in fact files in /jobs their names cannot be changed without the write permission for /jobs. In the subdirectories of /jobs/ everyone is allowed to do anything with the commands above.

Also, be sure to set the permissions of new directories to rwx as you add them.

(edit by Bill K to fix the examples--the solution was correct but he misread the question due to the strange coloring SO added)

like image 172
Johannes Weiss Avatar answered Dec 11 '25 03:12

Johannes Weiss