Cannot delete any files (otherwise I'm fine)

November 8, 2017 449 views
Apache WordPress Ubuntu 16.04
shelly
By:
shelly

HI there,

I've searched the forums, but haven't found an answer to this problem. I'm running WordPress on Ubuntu 16/LAMP. A few months ago, I removed my root user and set a new user to handle everything, added in an SSH key, everything's great.

However, last week, I had to wipe my computer and reinstall the OS (I'm on Mac Sierra) due to something really stupid I did that was 90% unadvisable :) The reinstall fixed the issue, and I went back in and reset my private ssh key to 600 permissions (because I knew that would be an issue).

So everything's moving along fine, I can log into my spot easily, it takes my key perfectly fine. But all I can do is upload files via SSH/SFTP. I can't delete, rename, move, change permissions - nothing else. Just upload. (same issue via Terminal commands as well as using Filezilla to do the transfers - I get a "Permission denied" message). I find this exceedingly weird.

I cannot log in as root anymore, either, because I locked the root user out when I made my new username. (It seemed like a good idea at the time, because using default login names is never a good idea for security purposes, but now I'm not so sure, because I think if I could log in as root, I could fix this.)

I'm 100% sure this has something to do with the fact that I wiped my computer and reinstalled. But other than changing the file permissions on my private ssh key, was there something else I needed to do? Or did I bork everything in a way that can't be fixed?

1 Answer

I think I got it :) It was a permissions issue. In Terminal, I was just forgetting to use "sudo" (you can thank the lack of coffee for that brainfart).

To make it work in my FTP program, I needed to set ownership to my username, not www-data. i.e. user:www-data instead of www-data:www-data.

Still need to be sure it works with the uploads folder (and updates for plugins, etc.) but at least I know what the issue is :)

Have another answer? Share your knowledge.