Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There is a directory named Joomla inside /opt/lampp/htdocs directory. As I created the directory, first thing I did was to change its mode as :

[root@Feddy htdocs]# chmod 777 Joomla

Then I unzipped a zip file into the Joomla directory :

unzip -d /opt/lampp/htdocs/Joomla zipfile.zip

but when I check the privileges for the directories/files under the Joomla directory whose access I changed it to 777,it returns :

[root@Feddy Joomla]# ls -l 
total 124
drwxr-xr-x. 10 root root  4096 Feb  4 05:35 administrator
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 bin
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 cache
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 cli
drwxr-xr-x. 13 root root  4096 Feb  4 05:35 components
-rw-r--r--.  1 root root   823 Feb  4 05:35 CONTRIBUTING.md
-rw-r--r--.  1 root root  3118 Feb  4 05:35 htaccess.txt
drwxr-xr-x.  5 root root  4096 Feb  4 05:35 images
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 includes
-rw-r--r--.  1 root root  1544 Feb  4 05:35 index.php
drwxr-xr-x. 10 root root  4096 Feb  4 05:35 installation
-rw-r--r--.  1 root root  1889 Feb  4 05:40 joomla.xml
drwxr-xr-x.  4 root root  4096 Feb  4 05:35 language
drwxr-xr-x.  3 root root  4096 Feb  4 05:35 layouts
drwxr-xr-x.  9 root root  4096 Feb  4 05:35 libraries
-rw-r--r--.  1 root root 17816 Feb  4 05:35 LICENSE.txt
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 logs
drwxr-xr-x. 16 root root  4096 Feb  4 05:35 media
drwxr-xr-x. 26 root root  4096 Feb  4 05:35 modules
-rw-r--r--.  1 root root   871 Feb  4 05:35 phpunit.xml.dist
drwxr-xr-x. 13 root root  4096 Feb  4 05:35 plugins
-rw-r--r--.  1 root root  4340 Feb  4 05:35 README.txt
-rw-r--r--.  1 root root   865 Feb  4 05:35 robots.txt
drwxr-xr-x.  5 root root  4096 Feb  4 05:35 templates
drwxr-xr-x.  2 root root  4096 Feb  4 05:35 tmp
-rw-r--r--.  1 root root  1715 Feb  4 05:35 web.config.txt

while forJoomla directory I get :

drwxrwxrwx. 19 root      root       4096 Mar 14 20:42 Joomla

Why does the files-directories inside the Joomla directory do not have the same privilege as the directory Joomla itself ? How can I give each directory-file inside the Joomla directory the 777 privilege ?

share|improve this question
    
Off subject, but 777 perms for any web served directory is a bad idea. If the machine ever gets compromised for any account level, I can put malware into your htdocs dir and try to compromise any web browsers that access it. These should be tightened up. –  Rich Homolka Mar 14 '13 at 16:50

2 Answers 2

up vote 2 down vote accepted

Because the file/directory permissions do not get inherited. They get set according to the umask for every new one created. You can change the umask or run recursive chmod -R after you done creating all new folders you need.

share|improve this answer
    
like chmod -R 777 Joomla ? –  Suhail Gupta Mar 14 '13 at 15:33
    
yes. you need to be in /opt/lampp/htdocs/ or just run chmod -R 777 /opt/lampp/htdocs/Joomla –  Alex P. Mar 14 '13 at 15:36

Because when you applied the permission the files were not in the the directory yet (and you didn't use chmod -R option, so even if they were inside the permission wouldn't have been applied to them). New files are copied (or created) using the mask of the user that is copying. You can re-apply the permissions on the directory (with -R for recursive) using chmod -R 777 joomla or you can use ACLs.

With ACL you can define the permissions for the existent files and default permissions for new files in the directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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