0

Mistakenly I wanted to change the ownership or /usr and /etc and /home by

chown -R username

because I thought in this case, I won't see any error saying permission denied in installing softwares and etc, but by having done it, got an error meaning that sudo was ruined. I tried to solve it by using

chown -R root:root /usr/lib/sudo 

and but no luck then tried it after entering command in below

mount -o rw,remount / 

in ubuntu recovery, while it is now the only way I can communicate with my ubuntu using root shell prompt. then I got error in below:

sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins

none of having said commands, solved the problem. after trying to access to my account to get backup of my data to reinstall ubuntu, I faced with another bigger problem: I can't see my username account in log in screen. I see only guest session. while even logging into guest session it brings me back again in log in screen. I really don't know what to do. please if help if you know how to solve it. I can't use sudo at all and can't also apt.get update in recovery ubuntu screen.

Majid Azimi
  • 101
  • 6
  • also http://askubuntu.com/questions/234603/how-do-i-deal-with-sudoers-so-must-be-only-be-writable-by-owner – JoKeR Jun 27 '15 at 21:24
  • @JoKeR I tried pkexec chown root /usr/lib/sudo/sudoers.so and got the error Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute program /usr/lib/dbus-1.0/dbus-daemon-launch-helper: Success then I tried chown root /usr/lib/sudo/sudoers.so and ofcourse I wasn't able to do that before doing mount -rw -o remount/. after that I rebooted the laptop and still see guest session only. please help! – Majid Azimi Jun 27 '15 at 21:31
  • did you do that from root shell? – JoKeR Jun 27 '15 at 21:32
  • @JoKeR yes I restarted and went throught ubuntu recoverty and using root shell I did it. now that is the only way I can't enter the commands – Majid Azimi Jun 27 '15 at 21:34
  • the workarounds provided by Eliah Kagan in that link is at best explanation how to solve this out. And sometimes indeed it might lead to re-installation because what you did it's not good. Don't be in a rush and read that answer thoroughly and understand each step. Basically revert each command that you've applied. – JoKeR Jun 27 '15 at 21:39
  • also related http://askubuntu.com/questions/73864/how-to-modify-a-invalid-etc-sudoers-file-it-throws-out-an-error-and-not-allowi – JoKeR Jun 27 '15 at 21:51
  • also the same situation as yours described here – JoKeR Jun 27 '15 at 21:58
  • @JoKeR thanks for your help I looked at all those links and left no stone unturned, but none of them worked for me. so gotta reinstall it. thanks any way! – Majid Azimi Jun 27 '15 at 23:45
  • in the future don't put -R flag everywhere that means recursively so it applies to each file and directory in a provided path. – JoKeR Jun 28 '15 at 08:24

1 Answers1

0

Create a Ubutnu live cd, mount the drive Ubutnu is installed on and do chown -R root: /media/ubuntu/YourDriveName/etc. Repeat this but replace etc with usr. I think there is no reason the change the owners of /etc and /usr.

Marton
  • 403
  • @JoKeR. I made the explanation more clear at least I think I did. the duplicated link didn't help having tried all solutions mentioned in that link – Majid Azimi Jun 27 '15 at 21:43
  • thanks I'm trying it and I'll let you know of the result. – Majid Azimi Jun 27 '15 at 21:43
  • I hope it helps. – Marton Jun 27 '15 at 21:49
  • I tried sudo chown -R root:root /media/ubuntu/4dc7958...../etc or also /usr. what should I do now? shall I now reboot it – Majid Azimi Jun 27 '15 at 21:55
  • Yes you should you could also change the owner of /home but that is less important. – Marton Jun 27 '15 at 21:58
  • thanks for your suggestion I tried carefully all steps but no luck still I'm not able to use sudo and see my user account in log in screen. thanks anyway. I learnt not to be too lazy in typing sudo password sometimes. – Majid Azimi Jun 27 '15 at 23:43
  • I feel sorry that I wasn't helpful, if reinstalling is an opportunity I would suggest you to do it. – Marton Jun 28 '15 at 07:37