3

I've deleted my password using sudo passwd -d alexwolf153. Now even though I have no password anymore sudo still keeps asking for one. What do I do?

EDIT: thankfully, my terminal with provided sudo privilleges was still open. I ran sudo passwd alexwolf153 <password> and now it's all back like it was before.

  • You need to boot to recovery and set a password. http://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password/24024?s=1|0.0000#24024 – Pilot6 Aug 19 '15 at 09:56
  • 1
    Wait, so this innocent command just ruined my day? Isn't there any mechanism to prevent such actions? Why doesn't this command ACTUALLY delete the password? Why there was no option named no password during installation? Why can't I use MY laptop without ANY passwords WITHOUT having to hack into system through command line? – Alex Wolf Aug 19 '15 at 10:01
  • This command is not innocent. There are plenty of command that can ruin your system. And Ubuntu is not designed to be used without password. And you do not HAVE to hack your system through command line. It is your choice. – Pilot6 Aug 19 '15 at 10:03
  • Could you recommend some distro that was as easy to use but WAS designed to be used without password? – Alex Wolf Aug 19 '15 at 10:04
  • Fine. I'm moving. – Alex Wolf Aug 19 '15 at 10:06
  • 1
    don't use sudo if you don't know what the commands do. every OS has a dangerous layer. – Skaperen Aug 19 '15 at 10:22
  • what do you expect sudo to say? "no password so i can't know if you are the authorized user"? – Skaperen Aug 19 '15 at 10:24
  • 1
    What I expected to see was something along the lines of Hey, I'm OS, I saw you deleted your password, so I figured, that, uhm, maybe, you don't want to be prompted for password every time you want to install a 4kB library?. – Alex Wolf Aug 19 '15 at 10:27
  • did you want sudo to just do the command w/o asking? FYI, that can be done (BTDT) man sudoers – Skaperen Aug 19 '15 at 10:29
  • that might be a nice feature. submit it to the sudo maintainers – Skaperen Aug 19 '15 at 10:31
  • I wanted to delete the password forever. Now I'm lowering my Ubuntu expectations and looking for what I can actually do to improve my experience. – Alex Wolf Aug 19 '15 at 10:31
  • did you check what would happen if you just entered no password (press enter) during the sudo promt? – FelixJN Aug 19 '15 at 11:06
  • Yes. I it would say the password is incorrect and would prompt me again. I already solved the issue, by the way. – Alex Wolf Aug 19 '15 at 11:06
  • Man, you have thrown away your key and now blame the lock for not guessing the fact and not unlocking itself. Good luck. – Barafu Albino Aug 19 '15 at 11:07
  • I'm glad you were able to recover so quickly and easily. Linux was designed for multi-user access through both the terminal and network. Windows was designed for a single user on a single stand-alone computer and then patched to create "security. " When I need to access secure areas of Linux, I have to enter a password, in Windows, I just click "yes". Linux has vulnerabilities and can be crashed, but unlike Windows, Linux makes it more difficult for unauthorized persons to do so. – Buck Aug 19 '15 at 11:08

1 Answers1

1

I had the same problem and this solved it, unfortunately ubuntu can not handle this situation you created. You need to boot to recovery and set a password.

Boot up the machine, and after the BIOS screen, hold down the left Shift key (note that for UEFI BIOS you might need press ESC instead). You will then be prompted by a menu that looks something like this:

grub menu edited by me

I've noticed on some systems that timing when to hit the left Shift key can be tricky, sometimes I miss it and need to try it again.

Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.

Now you should see this menu:

enter image description here

Using the arrow keys scroll down to root and then hit Enter.

You should now see a root prompt, something like this:

root@ubuntu:~#

At this stage you should have a read-only filesystem. You have to remount it with write permissions:

mount -o remount,rw /

Now we can set the user's password with the passwd command. (In this example I will use jorge as the example, you need to substitute whatever the user's username is):

root@ubuntu:~# passwd jorge
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu:~#

Type in what you want the new password to be at the prompt. After it's successful reboot the machine and the user will be able to log in with their new password.

Recovery Mode documentation
Lost password documentation

There is concern about this being a security vulnerability. It is not. You need to have physical access to the machine to do this. If someone has physical access to your PC, they could do far worse than change a password. When it comes to physical access, the battle for security is lost. Be wary of who you let on your PC.

Even setting a root password will not be successful, as one can simply boot with init being /bin/sh and have full root access. Again, given physical access, anyone with computer knowledge can do ANYTHING to your computer.

Thundercoal
  • 125
  • 1
  • 12