I checked the file and folder permission of /var/www/html/ using stat -c '%A %a %n' *

Folders : 775

Files: 664

drwxrwxr-x 775 includes
-rw-rw-r-- 664 index.php
-rw-rw-r-- 664 maintenance.html
drwxrwxr-x 775 phpmailer
drwxrwxr-x 775 recaptcha
-rw-rw-r-- 664 robots.txt
drwxrwxr-x 775 chosen
drwxrwxr-x 775 css

The permission of sub folders and files of folders copied into /var/www/html is also the same. For eg. permissions of /var/www/html/phpmailer is

-rw-rw-r-- 664 class.phpmaileroauthgoogle.php
-rw-rw-r-- 664 class.phpmaileroauth.php
-rw-rw-r-- 664 class.phpmailer.php
-rw-rw-r-- 664 class.pop3.php
-rw-rw-r-- 664 class.smtp.php
-rw-rw-r-- 664 composer.json
-rw-rw-r-- 664 composer.lock
drwxrwxr-x 775 examples
drwxrwxr-x 775 extras
-rw-rw-r-- 664 get_oauth_token.php
drwxrwxr-x 775 language
-rw-rw-r-- 664 LICENSE
-rw-rw-r-- 664 PHPMailerAutoload.php
-rw-rw-r-- 664 VERSION

Question 1: Why are the permissions defaulting to this?

Question 2: How can i rewrite all of this to Files:644 and Folder:755 ie. how can i change the permission of phpmailer folder to 755, its files to 644, change permission of its subfolders and its files to 755 and 644 respectively.

Question 3: How can i default the permissions to 644 for files and 755 for folders.

  • 1
    What is the group? There is usually a group with the same name as the user. Files in /var/www/html usually are user: www-data, group: www-data. In that case rw for both user and group is fine. – Stephen Ostermiller Apr 27 '18 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.