Ubuntu File and folder permissions
I'd rather recomment you to have different permissions for directories and files, because you'll need to run some commands inside of directory (like ls, cp, cat etc.), and they require "executable" permission.
At the same time I strongly recommend you to add "executable" bit only to that files, that should be executable - some scripts, commands, etc.
You may use the following scheme to set permissions on files&directories separately:
sudo find . -type d -exec chmod 775 {} \;
for directories
sudo find . -type f -exec chmod 664 {} \;
for files,
Instead of ‘.’ you may use the full path to needed file or directory. 775 & 664 - are binary-written permissions. More information about them you may receive there - http://linuxcommand.org/lts0070.php
If you'd like to provide full permissions on files and directories, you may perform the following:
sudo find /opt/lampp/htdocs -type d -exec chmod 777 {} \;
for directories
sudo find /opt/lampp/htdocs -type f -exec chmod 666 {} \;
for files.
Also take care about owner:group_owner parameters, they're also important for you.
Related videos on Youtube
Gammer
Updated on September 18, 2022Comments
-
Gammer over 1 year
sudo chmod -R 777 /opt/lampp/htdocs
output is
chmod: changing permissions of .... Operation not permitted
I want to give every permission to htdocs and all its sub-folders and to every file on all the sub-folders .
Thanks
-
0x2b3bfa0 about 9 yearsTry
sudo chmod -R a+rwx /opt/lampp/htdocs
-
Elder Geek about 9 yearsWhy would you want to that?
-
Gammer about 9 yearsNot working @Helio & Elder Not everything got the permissions , I copied my project folder to htdocs where it should be . Now not all the files are loading . I want to give every permission to htdocs . read write execute delete .
-
0x2b3bfa0 about 9 yearsTry this:
sudo su
and then type your original command in the root prompt. -
Faizan Akram Dar about 9 yearsTry sudo chmod -R 777 /opt/lampp/htdocs/*
-
sangharsh over 8 years@Helio hi, why do not you include you comment in answer? It has helped me.
-
0x2b3bfa0 over 8 years@sangharsh: I think that this dirty hack doesn't deserve to be an answer. If it worked for you, simply upvote the comment to give it more visibility. However, if do you find my comment so interesting, make a answer by yourself with the command. Then notify me and I'll upvote. ;-)
-
-
Gammer about 9 yearsStill not working Bro
-
ihor_dvoretskyi about 9 yearsShow us the output of:
sudo ls -lsa /opt/lampp/htdocs
please -
Gammer about 9 yearsoutput : total 72 4 drwxrwxrwx 7 755 www-data 4096 مارچ 13 01:56 . 4 drwxr-xr-x 30 root root 4096 مارچ 12 18:32 .. 4 -rw-rw-rw- 1 755 www-data 1441 نومبر 12 20:49 applications.html 4 -rw-rw-rw- 1 755 www-data 2142 اپريل 29 2013 bitnami.css 4 drwxrwxrwx 20 755 www-data 4096 مارچ 12 18:25 dashboard 4 drwxrwxrwx 2 755 www-data 4096 مارچ 12 18:24 img 4 -rw-rw-rw- 1 755 www-data 256 فروري 6 2009 index.php 4 drwxrwxrwx 12 755 www-data 4096 مارچ 12 18:08 shuffle_source