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?
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.
Click below to sign up and get $100 of credit to try our products over 60 days!