1

What is the most reliable way to give all users read/write privileges for a given directory, all of its subdirectories, and files in CentOS 7?

In an eclipse web application project that uses Maven, I am getting the following compilation error in the pom.xml:

Parent of resource: /home/user/workspace/MinimalDbaseExample/target/m2e-wtp is marked as read-only.  

Since this sounds like a permissions issue, I typed in the following in the CentOS 7 terminal:

chmod -R ugo+rw /home/user/workspace/MinimalDbaseExample/target/

And I also tried:

chmod -R 0777 /home/user/workspace/MinimalDbaseExample

But eclipse is still showing the compilation error, even after multiple Project clean and Maven update operations. However, I am able to import the same zipped project file into a Windows version of eclipse, and there is no compilation error related to file permissions in the Windows version, so this causes me to wonder if perhaps my above chmod statements did not actually open up the file permissions in the CentOS 7 machine.

Is there a better statement syntax that can reliably open up read write permissions to all users for the given directory and all its recursive subdirectories and files?

  • I'm not familiar with eclipse but maybe the read-only is something defined in the project rather than the file system? Another possibility is that some files are not owned by you so you cannot chmod them, but then chmod should have complained. – Bjorn Munch Apr 25 '15 at 6:51
  • @BjornMunch I am root. – CodeMed Apr 25 '15 at 6:52
  • 1
    You should also consider whether SELinux is causing this. You can temporarily disable it with sudo setenforce 0. – garethTheRed Apr 25 '15 at 7:07
  • Also, try namei -lx /home/user/workspace/MinimalDbaseExample/target/m2e-wtp which will shown you what's mounted where as well as permissions for the whole directory tree from root to leaf-node. – garethTheRed Apr 25 '15 at 7:20
  • @garethTheRed Thank you very much for looking into this. Please see EDIT to my OP describing the results. I am still experiencing the same problem. What else can I try? – CodeMed Apr 26 '15 at 20:51
6

You said you wanted to grant read and write permissions to all subdirectories and files under: /home/user/workspace/MinimalDbaseExample ... right?

Octal 0777 permissions grant rwxrwxrwx symbolically.

Octal 0755 permissions grant rwxr-xr-x symbolically.

Octal 0666 permissions grant rw-rw-rw- symbolically.

To set read/write/execute permissions to the /home/user/workspace/MinimalDbaseExample directory and all files and folders within it, choose which permission set you want, and do the following as an example:

1) Make your present working directory : /home/user/workspace

2) Type: chmod -R 0777 MinimalDbaseExample/

Following this procedure exactly, grants the folder MinimalDbaseExample/ and all files and subdirectories therein 0777/drwxrwxrwx permissions.

I tested this setting up some dummy directories under my '~' directory and verified it worked.

Credit goes to this thread, but it should not be at all this complex... I hope you make progress.

https://stackoverflow.com/questions/3740152/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in-linux-ubunt

  • I revised my post you could try this instead, as @garethTheRed suggests, it should be quite straightforward unless SELinux or some other layer is in some way making this more complex then usual. – nomad.rc Apr 27 '15 at 6:52
  • The solution was to move the project to a different eclipse workspace on the same CentOS devbox, and let eclipse manage the permissions. – CodeMed Apr 27 '15 at 20:57
  • Thank y0u and +1. This problem emerged on a different machine. In the new situation, your revised two step solution above worked. – CodeMed Jun 30 '15 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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