1

I found this command lines on the net:

find . -type f -exec chmod 644 {} +
find . -type d -exec chmod 755 {} +

I'm not sure of what they do when executed... In theory I guess they go search of all the files and convert them to permissions 644 and the second line search for all the folders and convert them to 755 but I don't thing that I did anywhing once I typed enter. Also, I needed these line because I wanted to to set these permissions for my wordpress configuration, but I accidentally typed these commands in the / directory and not in /var/www/html/wordpress.... Can I stay calm or I did something wrong and my server will have problems? By now, it seems to work normally...

Still one thing: can you tell me the best and fastest way to switch the permissions of all the files inside /var/www/html/wordpress to 644 and all the folders inside /var/www/html/wordpress to 755?

--UPDATE--

I checked the history of terminal and it seems that I was on /root/ home when I executed these lines, so it's a great news!

  • You ran above commands in the / directory as root? – schaiba Apr 14 '17 at 13:04
  • yeah I did, I was logged as root – CatchJoul Apr 14 '17 at 13:06
  • I'm running debian 8 – CatchJoul Apr 14 '17 at 13:15
  • I imagined that I committed a serious error. But the point is that the servers seems working.. I mean, I don't notice anything not working... And also, when I ran that command, it executed in a second, no kind of waiting for the switch of permissions of all the files and folders of the system... is it possible to switch permissions to all the files and folders of the entire system in a so short time? Is it possible that I did nothing and is not necessary to reinstall debian? – CatchJoul Apr 14 '17 at 13:20
1

It's easy to recover from an error like that with a RHEL-based distribution. But with Debian, at this point, the easiest thing to do is to reinstall Debian. Next time you have to write:

find /var/www/html/wordpress -type f -exec chmod 644 {} +
find /var/www/html/wordpress -type d -exec chmod 755 {} +
  • what does the command "find . " do instead? – CatchJoul Apr 14 '17 at 13:21
  • 2
    On Debian, I have used something along the lines of apt-get --reinstall install $(dpkg --get-selections | grep install | grep -v deinstall | cut -f1) to recover in a similar situation. – Alex Stragies Apr 14 '17 at 13:54
  • Thanks @Christopher. I’d also go with Alex’s solution on Debian, instead of reinstalling... – Stephen Kitt Apr 14 '17 at 14:38
  • I appreciate Alex's solution, too, sort of an inline reinstallation. Am testing it now. Seems like a gem to remember. It's a tad more complicated when all files have 644 permissions. – Christopher Apr 14 '17 at 14:41
-1

You can run this command:

sudo chmod -R 755 /var/www/html/wordpress 
  • be careful mate. it's a dangerous thing to edit permissions.
  • Only the folders? if so, check this post link – CountOlaff Apr 14 '17 at 13:17
-1

Use bellow command

chmod -R u=rwX,og=rX /var/www/html/wordpress 

where

  • R for recursively
  • = sign overwrite existing permision
  • X (Capital X) execute permission should only be set on directories, and not regular files

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.