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 :|
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 :|
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
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
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
.
sudo chmod 755 -R /opt/lampp/htdocs
-R make every sub folder ,including current folder