Regain control of accidental permission change of '/'

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.