1

I don't know what's wrong in my pc. It runs on Ubuntu 16.04.

When I give sudo command, it asks for password. When I give password, it does not accept.

sudo -i
[sudo] password for alpha: 
Sorry, try again.
[sudo] password for alpha: 
Sorry, try again.
[sudo] password for alpha: 
sudo: 3 incorrect password attempts
alpha@alpha-Inspiron-15-3567:~$ 

The password is correct, I checked that. The keyboard layout is okay, I typed the exact password.

To fix this I tried to follow this: Cannot run any sudo command

The Simple fix one did not work, so I tried the complex fix one, rebooting in recovery mode. Got to this step:

recovery menu

bit I could not enter the whole command of

mount -o remount,rw /
chmod chmod u=rwxs,g=rx,o=rx /usr/bin/sudo /usr/bin/pkexec
exit

before I could complete /usr/bin/sudo, it started to run commands on its own and resumed. So, here I am, not understanding anything. Can anybody help me ?

Lorenz Keel
  • 8,905
Spectra
  • 211

1 Answers1

0

You are executing these commands from a root shell prompt, so you don't need to preface the commands with sudo and you don't need to run sudo -i at all because you are already root.

The command in this answer is incorrect because chmod is repeated twice:

chmod chmod u=rwxs,g=rx,o=rx /usr/bin/sudo /usr/bin/pkexec  

The correct command is:

chmod u=rwxs,g=rx,o=rx /usr/bin/sudo /usr/bin/pkexec  
karel
  • 114,770
  • so instead of "sudo -i'', I should give only "-i ? – Spectra Sep 17 '18 at 15:35
  • You don't need to run sudo -i at all because you are running the commands from a root shell prompt, so you are already root. – karel Sep 17 '18 at 15:40
  • Another thing I wanna ask, It is asking for password of alpha. and I am giving the password for the user alpha. I am using the pc as alpha right ? still when I am using teminal, I am using it as root, while i am logged in as alpha. I cant connect this. I am new to this, so can you explain a little please ? – Spectra Sep 17 '18 at 15:50
  • 1
    Your user that you are currently logged in with can do almost every task, except for tasks that require root privileges like installing or uninstalling software or changing the permissions on files that are not owned by the currently logged in user, such as files that are owned by root. To preform these operations requires prefacing the commands by sudo in order to temporarily give the non-root user root privilege to run this command. This is a security measure that protects Ubuntu from unwanted escalation of root privileges, by making it temporary and only enabled in the terminal. – karel Sep 17 '18 at 15:55
  • In my case, I dont require sudo prefix as I am using root shell prompt. How I am able to use root shell (super user) while I am logged in as alpha (simple user) ? – Spectra Sep 17 '18 at 16:09
  • /usr/bin/id will show you what your UID and GID are in this environment. – waltinator Sep 17 '18 at 16:15
  • 1
    In a normal Ubuntu environment run sudo -s to get a root shell and exit to exit, but this is not the best way to do it. Instead run sudo -i and then you can run commands with root privileges without using sudo and then run exit to exit back to normal user when you are finished. – karel Sep 17 '18 at 16:16