Ubuntu: How can I recover from accidental chown -R [duplicate]



Question:

I am an Ubuntu newbie, and I accidentally typed chown www-data:www-data * -R.
After a while, I tried to restart, but my computer couldn't even start, saying:

# Your screen, graphics cards, and input device settings could not be detected correctly.   # You will need to configure these yourself.   

the command I executed is like this:

cd /home  sudo chown www-data:www-data * -R    sudo usermod -a -G www-data username  

Is there any way I can get out of this mess? Thank you


Solution:1

Try booting using advanced settings, and do a system restore...there is an option for that on the ubuntu bootloader menu


Solution:2

If you accidentally change the ownership of everything in /home and it contains only home directories named after their respective owners, then you can revert that change as root like this:

cd /home  chown root:root .  for f in *; do    case "$f" in      lost+found) owner=root:root;;      *) owner="$f:";;    esac    chown -R "$owner" "$f"  done  

There may be a few corner cases like configurational or temporary files of some subsystem like X.org or Pulse inside those directories, which should be owned by root or some system account, but they shouldn't be too much of a problem.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »