Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1162  / 2 Years ago, fri, september 2, 2022, 2:39:25

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 ?


More From » permissions

 Answers
1

If you have successfully added your 'ubuntu' account to the group www-data, you can now give your files and directories group write permission. The reason it was still failing is that the group www-data does not have write.


chmod -R g+w .


Should work for you.


[#1792] Saturday, September 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
poefor

Total Points: 379
Total Questions: 95
Total Answers: 115

Location: Serbia
Member since Tue, Jul 26, 2022
2 Years ago
poefor questions
;