how to set "rw-r--r--" file permission instead of rwx------
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
how to set "rw-r--r--" file permission instead of rwx------
Hi, I've coded an app with LAMP, in one html form I use 6 images files, but just 2 of them are displayed, now, I was fighting checking everything: the php code, html tags, css tags, and apache2 conf and nothing works, but guess what, I decided to view the permission of the files an I obtained these:
use the chmod to change the permissions chmod 0644 filename
If you read the manpage for chmod you'll see a good explanation of the different permissions.
Essentially its broken into 3 parts, user, group and world
-rwx------ is read, write, and execute permissions for user
-rw-r--r-- is read, write for user, read for group and world
use the chmod to change the permissions chmod 0644 filename
If you read the manpage for chmod you'll see a good explanation of the different permissions.
Essentially its broken into 3 parts, user, group and world
-rwx------ is read, write, and execute permissions for user
-rw-r--r-- is read, write for user, read for group and world
-rwx------ is read, write, and execute permissions for owner of the files
You might also want to look at your personal umask value. The umask command can change your default mask when creating file. However having a umask of 022 would create files with rw-r--r-- permissions. You don't want x permissions by default. This is usually set in ~/.profile.
Enter "help umask" in the bash shell. The umask command is a bash builtin command.
A combination of the letters ugoa controls which users’ access to the
file will be changed: the user who owns it (u), other users in the
file’s group (g), other users not in the file’s group (o), or all users
(a). If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
Even though I've lived on *nix systems for > 25 years, I still have to go back a a mnemonic UGO (User, Group, and Other) when using the chmod letters (octal requires no thought). So if you have trouble with these (or stalactite/stalagmite), avoid thinking Owner because the letter O is otherwise owned (used!) by chmod's Other.
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 459
Rep:
"tamayo" is both a group and a user.
There are baically two differences between files that got rendered and those that didn't.
(1) Those that got rendered had no execute permission for the user.
(2) Those that got rendered had also read rightfor all (group and others).
So which is it?
Normally one assumes that in Apache server (php is the front end) controlled by the user permission. But if this were so, all 6 files should be readable. (since all have read permission for the user tamayo).
Howeevr, the four files that don't get rendered by apache have an "x". Maybe its a security issue.
I dont have access to an Apache server but if you could try it out and post the result, it would really help.
End
So it looks like Apache renders based on the group flag.
The apache process runs under its own UID/GID, lets' call it www/www.
Therefore, any files that apache needs to read must readable by www/www. The execute permission has no relevance.
If the files have owner/group tamayo/tamayo, then the files must have minimally --6 permission (where -'s are irrelevant).
If the files are owner/group tamayo/www, then the files may have either or both of -6- or --6 permission.
If the files are owner/group www/tamayo, then the files may have either or both of 6-- or --6 permission.
When suexec is enabled, things change.
[ AnanthaP - the term "rendered" is inaccurate and misleading; access permission is the appropriate concept, as this has nothing to do with bit blasting, but is about simple file access permissions ]
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.