views:

267

answers:

5

So I want a way to set chmod 755 to /opt/lampp/htdocs and all of its content including subfolders and files, and If I create a new folder or file the chmod of that should be also 755.

chmod 75 /opt/lampp/htdocs works but only for this folder :|

+2  A: 

To set to all subfolders (recursively) use -R

chmod 755 /folder -R

And use umask to set the default to new folders/files cd /folder umask 755

Topera
DO NOT set your `umask` at 755! You won't be able to list, read or use any files or directories you create!
sleepynate
@sleepynate - you're 100% right!
Topera
+3  A: 

Check the -R option

chmod <permissionsettings> <dirname>* -R

in future you can save a lot of time by checking the man page first

man <command name>

so in this case man chmod

Steve Robillard
what's that `man`?
CIRK
it stands for manual page and is a linux command that shows the man page for a command (most linux commands have a man page). try man ls or man man.
Steve Robillard
+2  A: 

sudo chmod 755 -R /whatever/your/directory/is

be care with that, it can really hurt you if you change the permissions of the wrong files/folders

+2  A: 

chmod 755 -R /opt/lampp/htdocs will recursively set the permissions. There's no way to set the permissions for files automatically in only this directory that are created after you set the permissions, but you could change your system-wide default file permissions with by setting umask 022.

sleepynate
+1  A: 
sudo chmod 755 -R /opt/lampp/htdocs

-R make every sub folder ,including current folder

JapanPro