2

As mentioned in this question, the sudo command in my live USB is not working. To fix this I need to run some commands. But every command I run says permission denied. How do I gain root access? Running su - asks for password.

Yashbhatt
  • 167
  • 3
  • 13
  • 1
    Possible duplicate of [Sudo command not working in live USB](http://askubuntu.com/questions/738107/sudo-command-not-working-in-live-usb) – David Foerster Feb 28 '16 at 09:09
  • @DavidFoerster In that question, I ask about fixing the `sudo` command and here I want root access. – Yashbhatt Feb 28 '16 at 14:31
  • 1
    `sudo` gives you root access. If you get `sudo` to work, then you get root access. If you want to run a shell as super-user use `sudo -s` or `sudo -i` depending on your needs. – David Foerster Feb 28 '16 at 14:41

1 Answers1

3

As only the sudo command is not working because of a badly configured /etc/sudoers file, you can use pkexec as temporary replacement:

pkexec su -

pkexec will prompt a GUI password dialog every time you run it, it seems not to work in a TTY or when booting to text mode as it needs a dbus component.

You definitely need to fix your /etc/sudoers file, becoming lazy and just using pkexec from now on is not the way to go. That's not what it's made for.

Byte Commander
  • 105,631
  • 46
  • 284
  • 425
  • In that case what would be the password? I was booting from a live USB. – Yashbhatt Feb 24 '16 at 12:21
  • The password should be empty, as you can read [here](http://askubuntu.com/q/103896/367990). – Byte Commander Feb 24 '16 at 18:51
  • This is the login password. But when I ran `su -`, it asked for password and keeping it blank gives me "Authentication failure". – Yashbhatt Feb 26 '16 at 05:06
  • You may not run `su -`, that will ask you for the root account's password (which is deactivated). You must run `sudo su -` or in your case where `sudo` is broken `pkexec su -` to become root with your own account password. – Byte Commander Feb 26 '16 at 10:17
  • Can't try it now. The pen drive is formatted. Thanks for the help though. – Yashbhatt Feb 26 '16 at 17:42