2018-07-05

WORDPRESS FILE AND FOLDER PERMISSION ON LINUX

#17:41 2018.07.04

#####################################
#WORDPRESS FILE AND FOLDER PERMISSION
#####################################


#LÝ THUYẾT: #Source: https://superuser.com/questions/91935/how-to-recursively-chmod-all-directories-except-files

#Chmod Recursive Folder Only:
chmod 755 $(find /path/to/base/dir -type d)
ex: chmod 755 $(find /opt/www -type d)

#Chmod Recursive FILE Only:
chmod 644 $(find /path/to/base/dir -type f)

#Listing Folder Only:
ls -ld */

#Listing Recursive Folder Only with full Permission Info:
ls -ld $(find /opt/www -type d)

#Listing Recursive FILE Only with full Permission Info:
ls -lh $(find /opt/www -type f)


#THE-END


#
.htaccess (444)
index.php (400)
wp-config.php (400)

#THỰC HÀNH: #root@srv001:/opt/www#

#1/ "All: - 755: Folder, 644: File "
chmod 755 $(find . -type d)
#Result: ls -ld $(find /opt/www -type d)

chmod 644 $(find . -type f)
or
sudo find . -type f -exec chmod 0664 {} \;
#Result: ls -lh $(find /opt/www -type f)

#2/ Exept:
chmod 400 $(find . -name index.php)
#Result: ls -lh $(find . -name index.php)

chmod 400 $(find . -name wp-config.php)
#Result: ls -lh $(find . -name wp-config.php)


chmod 444 $(find . -name .htaccess)
#Result: ls -lh $(find . -name .htaccess)


#THE-END

#DONE DONE DONE


No comments:

Post a Comment