I am new in ubuntu, i am trying to run following command
sudo su -
Bu i am getting following message
sudo: unable to open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy pluginPreviously it was running but when i run following command
chmod 741 /etc/It is stop working, i don't have root user password, i am running my machine on Amazon.
Pls suggest me how can i fix this problem.
13 Answers
pkexec chmod 0440 /etc/sudoersThen try sudo -s
Normal permissions for /etc/ are: rwx r-x r-x root root
Using chmod 741 /etc/ means to set the permissions /etc/ to rwx r-- --x.
Notice the lack of r in the third field. These three fields represent: Owner, group, others. Since the default owner and group is root you just prevented everyone except root from reading files in /etc/. This is a bad thingtm.
If you get a root prompt then you can revert these changes easily enough, but for that you need:
- Either an already open root prompt.
- A way to log in as root or any uid 0 account.(You need to manually set this in Ubuntu.)
- Right to
suorsudo(which you just broke). - Or access to the filesystem from another OS.
- Or reinstall the system. (Easiest to do if you just set it up a few minutes ago, but also the least educative way)
For a normal desktop or a server with remote access card (HP ILO, Dells DRAC etc) I would boot into single user mode, provide the root password if needed, and fix the permissions.
Or I would boot from a liveCD (or pendrive) and do the same.
On Amazon this is a bit harder because you have no physical access. However you can start a second instance and mount your old OS disk from there.
1Execute command:ls -l /etc/sudoers If result shows zero hard link like below maybe your filesystem damaged:
-r--r----- 0 root root 1014 2013-19-4 17:40 /etc/sudoers
else read :
6