View Full Version : Incorrect user name or password on logon

23-May-2012, 03:00
This one blows my mind and I'm stumped. Logged in as root, I create a new user bash script as follows:

useradd mynewuser -d /home/red -m -p GoBashMe123!

I can su to mynewuser via
su mynewuser

and I see:

However, if I logout of SUSE 10 sp1, and I attempt to logon to via this account, I get the message "incorrect user name or password". I am logging on via Switch User or the Initial Logon screen. I can logon via root in every way possible.

I've used this exact script on other installations of SUSE and it works perfectly.

I've also done this manually, and no joy on this instance.

I have tried all lower case, shorter passwords, etc and no joy.

I can see that the user is set up in YAST, and it appears normal in all aspects, including the "disable logon" is unchecked. If I su as the user, in a terminal window and try and delete while root, the user can't be deleted because it's logged in.

23-May-2012, 08:31
However, if I logout of SUSE 10 sp1

Do you mean SUSE Linux Enterprise Desktop 10 SP1? If so, are you aware that went End of Life years ago and so you should no longer be using it? SLED 10 is still supported but you need to be using SLED 10 SP4.

useradd mynewuser -d /home/red -m -p GoBashMe123!

I don't have a copy of SLED 10 SP1 to hand (see previous comment about it being End of Life) but on SLED 11 SP2 that command doesn't create a user who's password is GoBashMe123! and nor would I expect it to. The man page for useradd reads

-p, --password password
Encrypted password as returned by crypt(3) for the new account.
The default is to disable the account.

So what follows -p needs to be an encrypted version of the password.

This works for me on SLED 11 SP2

$ useradd mynewuser -d /home/red -m -p $(openssl passwd -1 plain_text_password_here)
Something to consider here is the possibility of that unencypted password being visible in the output of ps and hence potentially sniff-able by other people logged in to the machine. I've not attempted to determine whether or not it is visible.

23-May-2012, 14:38
Thank you! Your example worked perfectly.

This script is used as part of an initial configuration build process and not in a production context.

I really appreciate your help!