0

I am using some webpages in my remote server(RHEL 8) and the directory is var/www/html/project. In the project files I have a charts folder and the .js files inside that folder will be update time to time.

So I am always make permissions for that directory files to be what I wanted. I need to find a method to make the default permission as 777 for all these files.

So my target directory is var/www/html/project/charts and I need to set any files(even though it deleted and recreated inside) with the permission to read,write and execute by anyone?

As an example I need to make this directory as default permission as 777. Is this possible?

chmod 777 var/www/html/project/charts/

I have found answers there. But I am confused where to add 777. How to set default file permissions for all folders/files in a directory?

8
  • 3
    The answer to the question you ask is "sticky bits". But: No. Setting a bunch of charting javascript files as 777 is definitely a bad idea in a served directory and you should not be doing it. There is a different solution to the problem you assume you'll be solving with this! So, why do you want to set the files' permissions to 777, although that definitely means that even the least privileged user (e.g. your web server scripts, a hijacked logging daemon…) can modify a file that then any high-privileged user would execute? (or if they wouldn't, why the 7?) Commented Jun 14, 2022 at 11:12
  • Not 777 exactly! I just need to make browser to read that file from the given path. @MarcusMüller
    – edublog
    Commented Jun 14, 2022 at 11:16
  • @ArtemS.Tashkinov where to add that number for the permission? setfacl 644 /<directory>?
    – edublog
    Commented Jun 14, 2022 at 11:17
  • You should consider using suExec for Apache2 or a similar mechanism if your webserver is nginx.
    – gerhard d.
    Commented Jun 14, 2022 at 11:21
  • 1
    @edublog, (ok sigh I need more coffee). I don't think you can use numeric permissions with setfacl, and instead you have to spell the permissions out. (Partly because ACL entries come separately for users and groups, not in one single block.) setfacl -d -m u::rwx,g::rwx,o::rwx dir should do to set the default ACL to what basically amounts to 0777. But that will still be modified by the permissions given in the open() system call, so you probably get e.g. 0666 for text files etc. And maybe you should leave the write permission off for "others"
    – ilkkachu
    Commented Jun 14, 2022 at 11:35

1 Answer 1

0

If directory permissions you want are really 777(which is very unlikely), than you need to set umask 0. It's more probable, that your question is wrong, and there is better solution for your permission problem, e. g. "the right" user (owner) and/or group and proper permissions for that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .