1

I have accidentally executed this command on my Ubuntu terminal

sudo chown -R 755 /var/www/html/buzo/wp-content/cd ..

Now every folder has this lock like symbol and my desktop has turned black.

What have I done? What do I need to do make it work again as it used to work before?

muru
  • 197,895
  • 55
  • 485
  • 740
bboy
  • 11
  • You messed it up big time. The non-existing user 755 is now the owner of a lot of files and directories. Which directories were affected depends on the current directory when you submitted that command. So which was that directory? And which user owned the files/directories before? (Let's hope it's the same user all over.) – Gunnar Hjalmarsson Apr 13 '16 at 16:50

2 Answers2

2

I'm afraid I have some BAD NEWS for you...

Refer to How can I recover from chmod -R a-wrx / command?

Basically, those two dots at the end of your command began a Recursive CHMOD of everything starting at one level up from wherever your current working directory (CWD) was. That's "OUCH" and is usually very bad. If your CWD was in your "~home" folder, there are symlinks in your ~home directory that are pointing to scripts and programs in system folders and these now have their permissions changed IN THE SYSTEM FOLDERS! Once CHMOD was in the system folders, I assume it recursively changed all the permissions of everything there as well since it appears from your description you've effectively locked your operating system.

I assume you've hosed your system and a backup of your important files is in order. I am not aware of a quick and simple solution to get all your permissions back the way they were unless you've made an image backup of your system prior to issuing that disastrous command. Look at "Aaron's" answer as well at that referenced posting - he refers to a tedious method that perhaps will provide a starting point - if you're a patient person and want to learn far more about your operating system than you bargained for. You can also refer to a similar question on ServerFault.com - read all the suggestions...

But, in general, recovery is mostly a lost cause and you may never get your system back the way it was. Save your personal data, re-install your operating system, and chalk this up to another of life's lessons learned.

  • Thanks for reply laslo i keep backup of ubuntu everyweek in my portable hardrive. What can be worked out ? – bboy Apr 13 '16 at 17:33
0
sudo chown -R 755 /var/www/html/buzo/wp-content/cd ..

would error out on the 1st part. The ".." is a problem though but we can not help you yet with this.

Important question that needs answering: in what directory where you when you executed this?

  • If in / you will need to re-install. Boot into a live session and make a backup of all your personal files and re-install, then restore the backup.
  • If somewhere else it might depend on where that was if it is fixable.

    Example: If in /var/www/html/ or deeper it is not a big issue since a simple ...

    sudo chown -R $USER /var/www/html/ 
    

    (change $USER to www-data or the other user name you use if you did not use your own username) would make it work again.

Rinzwind
  • 299,756
  • I can still login through terminal and i think i was inner directory and what i have seen all of the directories under home has owner 755, what should i do ? Above that its all fine under root – bboy Apr 13 '16 at 17:22
  • @bboy: Sounds like sudo chown -R $USER $HOME might help. – Gunnar Hjalmarsson Apr 13 '16 at 17:24
  • @gunnar so i should type like sudo chown buzoo /home ? Can i type it anywhere i mean no matter in which present directory i am in ? – bboy Apr 13 '16 at 17:28
  • @bboy: Actually you can type exactly as I wrote. If you do that, the current directory doesn't matter. But please copy and paste. No more typos... (I have three objections/questions on what you suggested: 1) Missing -R 2) Is it buzoo or buzo? 3) /home may affect also other users' directories (if any). – Gunnar Hjalmarsson Apr 13 '16 at 17:49
  • @bboy good you got it fixed :D and yes the command you typed would have worked too. Be more careful next time ;) – Rinzwind Apr 13 '16 at 18:03
  • Ofcourse lesson learned for using chown – bboy Apr 13 '16 at 18:05