1

We are facing issues of permissions. scenario is

We have Federoa with Xammp server running and shared project directory for local network to create project folders for project development. Everything is good except one thing that when we create new folder on network it does not have full rights but "drwxr-xr-x" and due to this our PHP program cannot upload files. It is all about insufficient rights permissions.

Before this Fedora installation, previous one was working perfectly fine. That we were able to create folders which were having default full permissions rights to do anything.

Commands and Results:

[root@umi]# setfacl -R -d -m g::rwx -m u::rwx -m o::rwx ajax_upload
[root@umi]# getfacl ajax_upload
# file: ajax_upload
# owner: root
# group: root
user::rwx
group::rwx
other::rwx
default:user::rwx
default:group::rwx
default:other::rwx



Then I created a directory inside ajax_upload directory from windows platform on network sharing named "test2"

[root@umi]# getfacl ajax_upload/test2
# file: ajax_upload/test2
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::rwx
default:other::rwx



You see "group::r-x" and "other::r-x"... below is ls -ld results

[root@umi]# ls -ld ajax_upload/test2
drwxr-xr-x+ 2 root root 4096 2014-06-27 11:29 ajax_upload/test2



Can anyone suggest what we do that when we create new folder it must have full rights like "drwxrwxrwx"?

0

If you mount your filesystem with acl support (i.e. /etc/fstab has acl in the options [4th] field for that filesystem), you can use the setfacl command to set default permissions for newly created files and directories:

setfacl -d -m u::rwx,g::rwx,o::rwx /target/directory

Now when any user creates directories inside of /target/directory/, those new dirs will be created with "drwxrwxrwx+" permissions. The + means that acls are present and can be shown with the getfacl command.

Of course, you'll want to make sure that /target/directory itself is writable by your users.

  • Our concern is not to create directories using commend line which we know that we can change permissions using CHMOD command... while we need to have it set for, when we create folder on network using windows platform... as described: we have "projects" folder shared from Linux and on windows we create folder in projects folder and here new created folder needs to have full permission. I tried to set umask 000 but it also did not work. Any suggestion? – UMI Jun 26 '14 at 7:16
  • @UMI I understand that chmod isn't sufficient and that's why I didn't suggest it. Did you try the setfacl command? – TheAmigo Jun 26 '14 at 10:50
  • Do you mean that if I run command "setfacl -d -m u::rwx,g::rwx,o::rwx /projects" then creating new directories will have full rights permissions? I you say yes then I give it try now.. waiting for your response – UMI Jun 26 '14 at 11:12
  • Yep, the -d sets that as the default permissions for new entries in that dir. – TheAmigo Jun 26 '14 at 11:27
  • Thank you for your response and I have strong feeling that it can resolve the issue but now after a test I have small issue remaining that this command sets rights "drwxr-xr-x+" while I need "drwxrwxrwx". Can you alter your command line so that I got my required rights please? – UMI Jun 26 '14 at 12:24
0

Instead of using mkdir (I'm guessing that is what you are using now), try using:

install -d -m 0777 /new/dir/

That will create a new dir called /new/dir/ with full permissions (like chmod 777).

The other solution is to use proper umask values for the user creating the directories. Please review this thread for more info and an example.


After reading your comments, I'm pretty sure the problem is with your current values for umask. Please read the following threads, to make sure you have the right settings in there - if not, make some changes and try again:

  • Our concern is not to create directories using commend line which we know that we can change permissions using CHMOD command... while we need to have it set for, when we create folder on network using windows platform... as described: we have "projects" folder shared from Linux and on windows we create folder in projects folder and here new created folder needs to have full permission. I tried to set umask 000 but it also did not work. Any suggestion? – UMI Jun 26 '14 at 7:15
  • oh ok, that's not in your problem's description. Can you provide the details on how the directories were shared in the first place? Edit your question with those details, please... "We have Fedora with Xammp server running and shared project directory for local network to create project folders for project development" it's a bit vague, considering your previous comment. Let's see if we can came up with something after getting more details :) – jimm-cl Jun 26 '14 at 13:37
  • please check first comment to your answer in which elaborated the scenario. – UMI Jun 27 '14 at 4:52
  • I have updated my question... let me know if you need anything else. – UMI Jun 27 '14 at 5:43
  • I updated my answer, I hope this helps :) – jimm-cl Jun 27 '14 at 15:12

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.