Regain control of accidental permission change of '/'

October 3, 2016 194 views
Apache DigitalOcean Security Nginx System Tools Ubuntu 16.04

We accidently chmod-ed 777 in whole directory structure. So, The situation is that we cannot access root or 'sudo' mode for our normal user. We also may have changed the permission of critical files like /etc/passwd /etc/shadow and /etc/sudoers , which seem to have causing the problem.

The idea solution, if it was our server would be to change the permission from another machine and then chroot back and do necessary changes. Since this is hosted on DigitalOcean cloud, this seems impossible.

How do I recover root and sudo access?

1 Answer

Unfortunately there is no quick way to restore filesystem permissions on Ubuntu if this occurs. Instead I would recommend opening a ticket with our support team. They can boot your droplet using our recovery ISO (a Debian based LiveCD image) that will allow you to get an SFTP service up and running in order to download a copy of your files. I would then recommend starting over with a clean droplet and restoring your services.

Have another answer? Share your knowledge.