I deployed a wordpress site on Ubuntu 20.04 using Nginx.
First I did:
sudo chown -R www-data:www-data .
Which solved issue I had when uploading plugin.
But now, when I connect FTP with my SSH key, using ubuntu user, I can see the files, but not modify them.
I checked the permissions:
ubuntu@ip-172-20-36-190:~/site$ ls -al
total 220
drwxr-xr-x 5 www-data www-data 4096 Mar 18 12:31 .
drwxr-xr-x 7 ubuntu ubuntu 4096 Mar 5 09:04 ..
-rw-r--r-- 1 www-data www-data 405 Feb 6 2020 index.php
-rw-r--r-- 1 www-data www-data 19915 Mar 10 00:26 license.txt
-rw-r--r-- 1 www-data www-data 7345 Mar 10 00:26 readme.html
-rw-r--r-- 1 www-data www-data 7165 Mar 10 00:26 wp-activate.php
drwxr-xr-x 9 www-data www-data 4096 Feb 22 15:10 wp-admin
-rw-r--r-- 1 www-data www-data 351 Feb 6 2020 wp-blog-header.php
-rw-r--r-- 1 www-data www-data 2328 Oct 8 21:15 wp-comments-post.php
-rw-r--r-- 1 www-data www-data 2913 Feb 6 2020 wp-config-sample.php
-rw-r--r-- 1 www-data www-data 3216 Mar 4 17:06 wp-config.php
drwxr-xr-x 8 www-data www-data 4096 Mar 3 13:23 wp-content
-rw-r--r-- 1 www-data www-data 3939 Jul 30 2020 wp-cron.php
drwxr-xr-x 25 www-data www-data 12288 Mar 10 00:26 wp-includes
-rw-r--r-- 1 www-data www-data 2496 Feb 6 2020 wp-links-opml.php
-rw-r--r-- 1 www-data www-data 3313 Mar 10 00:26 wp-load.php
-rw-r--r-- 1 www-data www-data 44993 Mar 10 00:26 wp-login.php
-rw-r--r-- 1 www-data www-data 8509 Apr 14 2020 wp-mail.php
-rw-r--r-- 1 www-data www-data 21125 Mar 10 00:26 wp-settings.php
-rw-r--r-- 1 www-data www-data 31328 Mar 10 00:26 wp-signup.php
-rw-r--r-- 1 www-data www-data 4747 Oct 8 21:15 wp-trackback.php
-rw-r--r-- 1 www-data www-data 3236 Jun 8 2020 xmlrpc.php
I tried to do a chmod -R +w , but I couldn't have write access on my files.
I also tried to add ubuntu user to www-data group, with
sudo usermod -aG www-data $USER
but still, but I couldn't have write access on my files
I did a chmod -R 777 .
in all my files, and it worked, is it ok to do that, I have heard it could be a security issue ?
What should be the good way to do it ?