7

I have created an account on ubuntu with the --disabled-password flag.

When I login to this account through ssh using public key authentication, and do a sudo command like apt install, sudo asks for a password. Although I do not know what it is because I disabled the password on the account.

What is the password for sudo on a disabled-password account?

10

That wont fly... you need a password for the sudo user to be able to disable the sudo password. So that goes the other way round: 1st disable sudo pwd then disabled-password. And I suggest NEVER to do this kind of action w/o a backup sudo user. Leave the 1st sudo user as is. Maybe with a good password (64 chars you generate randomly and store that in an safe). Use a 2nd sudo account to set your method up. That way you can use your 1st sudoer as a fallback.

And you need

{user} ALL=(ALL) NOPASSWD:ALL 

in

/etc/sudoers.d/{user}

If you can't un-disable you can use live session to edit the sudoers file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.