0

So im stuck in a loop after do something stupid

i had a / in a sudo chown command due to my fat fingers, i CTRL-X the operation but not before /etc was changed to a non root user.

so now trying to run sudo i get the following

sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialise policy plugin

trying to run the command

pkexec chown root:root -R /etc

doesnt work as this happens

ozhound@UbuntuServer:/$ pkexec chown root:root -R /etc
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/chown' as the super user
Authenticating as: ozhound,,, (ozhound)
Password: 
polkit-agent-helper-1: error response to PolicyKit daemon:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized

This incident has been reported.

I cannot login as root as i never enabled root

any suggestions? the other threads similar to this assume i have sudo access or the pkexec works.

ubuntu server 16.10

Ozhound
  • 23
  • 1
  • 6
  • 1
    I suggest that you create a CD/DVD/USB boot drive from a small desktop iso file, for example Lubuntu 16.04.1 LTS or 16.10 desktop or some linux rescue system. Boot your computer from that drive, mount the internal drive to /mnt and change the owner of /mnt/etc to 'root` alias user #0. – sudodus Feb 18 '17 at 06:12

2 Answers2

1

I used the latest Ultimate Boot disk (which runs Redhat), mounted the drive and as sudodus suggested, I chowned the affected directories back to root:root. restarted and now sudo is available to me again.

Ozhound
  • 23
  • 1
  • 6
0

You can try these codes too:

ls /dev/disk/by-uuid -alh

Try to mount with the following codes:

mount /dev/disk/sda1 /target

mount -t ext3 /dev/disk/sda1 /target

nano /etc/group

Don´t forget your username must be added to admin.

I recommend this link: How do I login as root?