2

Totally new to linux - trying to learn it as I'm a PHP developer. I was having some issues with wordpress and in trying to fix them my permissions got out of whack for my /var/www/html folder, to the point where I had to launch Atom using sudo atom just so I could write to my files. Today I tried to fix the issue, and honestly I don't understand the linux permission system whatsoever, so I just turned to Google. I found a recommendation to use:

sudo chmod 766 -R /var/www/html

I used that, and now everything in the html directory has been changed to a binary file (Binary (application/octet-stream)). All of the folders have been changed to binary files with the same name as before and all of the files that were inside of those folders are nowhere to be found. Is there any way to recover these files?

  • 3
    It's almost always a bad idea to use chmod -R, particularly with an insane mode like 766. Fix the permissions and see if that resolves the problem. I'd imagine you could use mode 644 for regular files and mode 755 for directories. – Chai T. Rex Mar 8 '18 at 1:18
  • Maybe your wordpress got hacked you are ramsoned? – davidbaumann Mar 8 '18 at 8:04
  • Could you please add the output of sudo ls -l /var/www/html to your question ? – Soren A Mar 8 '18 at 8:58
  • I guess you see application/octet-stream because you are owner of these files and you set all of them to executeable (766)... in regards to "ll of the files that were inside of those folders are nowhere to be found" I guess nautilusmight have a problem with that? try to navigate on the commandline – Robert Riedl Mar 8 '18 at 11:30
-1

I'm not going to pretend to know anything about Linux permissions or why this happened, but per advice in the comments I tried resetting all of the permissions for /var/. I used the step-by-step guide here and it totally fixed the issue - my files are back. Thanks!

  • Don't use answers to add comments. Update your question with relevant new information, or add a comment. – Soren A Mar 8 '18 at 6:48
  • @SorenA I'm not going to say you are wrong, but the website has a button that clearly says "Answer Your Own Question." I posted a question here, and I found the answer and linked to the steps I used. If you have an issue with my use of that button for exactly what it says, take it up with the design team. – user393466 Mar 8 '18 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.