Fix sudoers permissions (without reboot)

Well, I was trying to link /etc/sudoers in my DropBox to back up the configuration and thought I’d just change the group permissions so that my user could read it; so I set it to group admin. Bit of a mistake that one as if you’re a linux guru you’ll know thats a bad idea (evidently I’m not)… you’ll get something like this when you try and sudo:

$ sudo su -
sudo: /etc/sudoers is owned by gid 121, should be 0

This is not a problem if you have a root password set up but if you don’t – e.g. if you’re running a Ubuntu like distribution (I’m using Mint at the moment) then chances are, you don’t have a root password set up and dont ever log in directly to root. So, cursed with the chicken and egg scenario of needing sudo privileges to fix sudo, you’re left with booting into a live CD or restarting in recovery mode.

Or are you…? There are alternatives like using kdsu or kdsudo I think but that means you have to have had them installed already. What if you don’t? Well, if you’re an admin user then log in to gnome, run the User Settings program and you can still use the unlock button and then edit the root user and give it a new password!!

Mint Linux User Settings

Mint Linux User Settings

Then you can obviously fix the permissions after switching user to root:

su - root
chown root:root /etc/sudoers

I’ve not seen this as a solution in my brief hunt around google so I thought I’d share it with the net…

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.