Skip to content

Magento2.4.6 sftp cannot access /var/www/html, how to modify the permissions of html files

I installed magento2.4.6 on Ubuntu22.04. I don’t know much about folder permissions, and now I can’t login to /var/www/html files using sftp. How can I solve this problem?

【FileZilla】

Status: Listing directory /var/www
Status: Directory listing of "/var/www" successful
Status: Retrieving directory listing of "/var/www/html"...
Command:    cd "html"
Error:  Directory /var/www/html: permission denied
Error:  Failed to retrieve directory listing

enter image description here

【SSH】

root@ip-123-45-6-78:/var/www# ls -al
total 12
drwxr-xr-x  3 root     root     4096 Apr 21 07:34 .
drwxr-xr-x 14 root     root     4096 Apr 21 07:34 ..
drwx--x--x 12 www-data www-data 4096 Apr 21 14:23 html
root@ip-123-45-6-78/var/www#

enter image description here