No longer have permission to access files using sftp for sudo user

Hi, I have recently installed wordpress on my lamp running on ubuntu 18.04. I followed this guide

Everything is working in wordpress but now I can’t upload, edit or browse my wordpress folder files using sftp after logging in as sudo user, root is fine though.

Note: I can access and modify files using terminal as sudo user, its just an issue with sftp.

In this tutorial this command is recommended- sudo chown -R www-data:www-data /var/www/etc…

so could it be its only allowing www-data group for such directory? How can I change it so files have access via both sftp, www-data?

Any suggestions would be appreciated.



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, @nkatla

May I ask if you were able to edit the files via sFTP with the sudo user and at some point this stopped working or you’re trying to configure for the first time?

Which is the exact error that you’re receiving in the FTP client when trying to access the droplet/wordpress files? Have you checked the folder/files permissions as well?

I would recommend taking a look at this step by step guide on how to create a non-root user with sudo privileges:

Then you could use that user to connect via SFTP.

Hope this helps!

Regards, Alex