1

I have run the command

sudo useradd testuser

Then when I run

su testuser

it ask for a password, and I have not set a password. So no matter what I type it gives me an authentication failure...

What am I missing here?

2

useradd does not ask/set the password. You need to set the password with the passwd command (so that the hashed password gets written in /etc/shadow):

sudo passwd testuser

Also, useradd is a low level utility, you need to specify options specifically, you might also need to create home directory for the user and set a login shell e.g.:

sudo useradd -d /home/testuser -m -s /bin/bash testuser

If you are on Debian (or any of it's derivatives), look at the adduser wrapper.

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.