LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing directory and file permissions (https://www.linuxquestions.org/questions/linux-newbie-8/changing-directory-and-file-permissions-940487/)

annec0010 04-18-2012 01:04 PM

Changing directory and file permissions
 
Hi All,

I have a Centos box which is hosting a website. I need to change permissions of the home directory (where the website files are)and files.

I need to change the folder permissions to 755 and file permissions to 644. How would I do this?

The main home directory have subfolders and files in those subfolders so I need file and directory permissions changed for everything that is in the home directory.

Any help would be most appreciated.

Chris

MensaWater 04-18-2012 01:18 PM

"home directory" has a specific meaning in UNIX/Linux. It is the directory in which a given user lands in on login.

The directory you're talking about would appear to be a "document root" for a web page.

Assuming you're using standard web setup for CentOS (which is derived from RHEL) then the key configuration files for Apache (httpd)web configuration are in /etc/httpd.conf. These aren't the ones you want to change however. These are the ones you want to check for the "document root" location.

To change permissions on a file you simply type: "chmod 755 <directory>" or "chmod 644 <file>" (for the permissions you asked about. Once you find the document root you can do this on those files. However you should be aware web applications are sensitive so it is possible you'd break something by changing permissions. You might want to store existing permissions on everything before making the change so you can restore the permissions if necessary.

Who is asking you to change these permissions? What exactly did they ask you to do?

annec0010 04-18-2012 02:29 PM

Thank you for clarifying those two.

The guys who wrote the website are asking for all directory permissions to be set to 755 and all file permissions to be set to 644. I believe they've written the site using Joomla and I think the reason for those change of permissions is due to issues with the CMS system not working properly from the back end.

catkin 04-18-2012 03:16 PM

Code:

find <path of the home directory> -type d -exec chmod 755 {} \;
find <path of the home directory> -type f -exec chmod 644 {} \;



All times are GMT -5. The time now is 07:28 AM.