SFTP Server says you do not have the required permissions. "Permission denied"

May 10, 2016 627 views
DigitalOcean

Hello everyone,
I'm having problems editing files in my droplet using Fetch, everything was working fine before until today... I'm basically trying to edit my style sheet but it's not letting me edit it because i apparently don't have the required permissions. I am able to access and view all my files and copy them to my desktop via Fetch using my SSH key, however i'm unable to delete or edit anything. When i look at the info of the folders, under ownership and permissions it displays that my current user can Read, Write, and Execute. Group: www-data same thing Read, Write, and Execute. Others : Read and Execute.

Any help is appreciated! Thanks.

3 comments
  • Which user are you logging in as via SFTP?

  • I'm logging in by a user i created to login with an SSH key instead of root. I disabled root login by editing vi /etc/ssh/sshd_config. Permitrootlogin no. I believe i followed either this video or something similar to this. https://www.youtube.com/watch?v=EuIYabZS3ow

    This is only affecting my users, not my root. I am able to edit and do anything as root, however it seems i can only login and view my files but not edit even though i believe i have given my user root privileges.

  • Okay i think i may have fixed my problem....
    Ran this...
    sudo chown myuser:www-data /var/www/html/wp-content
    changed priviledges
    sudo chown www-data:myuser /var/www/html/wp-content
    Then...
    sudo service ssh restart

    I feel like I've done this before but for some reason it wasn't working until i ran that in the terminal again, now i'm able to edit and delete files without a window popping up about not having permission.

1 Answer

This question was answered by @EduardoMartinezDesign:

Okay i think i may have fixed my problem....
Ran this...
sudo chown myuser:www-data /var/www/html/wp-content
changed priviledges
sudo chown www-data:myuser /var/www/html/wp-content
Then...
sudo service ssh restart

I feel like I've done this before but for some reason it wasn't working until i ran that in the terminal again, now i'm able to edit and delete files without a window popping up about not having permission.

View the original comment

Have another answer? Share your knowledge.