D
D
Dred Wolf2021-01-30 18:11:28
linux
Dred Wolf, 2021-01-30 18:11:28

How to properly create a user with a password in Linux?

Manjaro distribution (kernel 5.9)

I want to create a user using useradd and the -p flag to specify a password when creating.
sudo useradd -p "12345" newuser
Switch to this user and enter this password
su newuser
su: Authentication
failed But it's not correct. What is the problem? Maybe I misunderstand how the useradd utility works?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Dmitriev, 2021-01-30
@DredWulf

You should carefully read the description of this flag. The password hash is passed as a parameter, not plain text.
So you first need to get the hash from 12345 , and then pass it to -p

S
Sergey Karbivnichy, 2021-01-30
@hottabxp

sudo passwd user

A
amiDMast, 2021-02-09
@amiDMast

man useradd

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question