Problem with useradd

Hello everybody,

I’m running OpenSUSE leap 15.1 on a VM and leap 15.2 on another. When I use the command useradd on the 15.1 VM and change to the user using su I will switch to the specified user.
When I so exactly the same on the 15.2 VM it will go straight to root and I don’t know how to even switch to the created user. The users do appear in the /etc/passwd file. Is this something you experienced before with the 15.2 distrubution?

I haven’t noticed the same but maybe I haven’t done exactly what you describe.
In any case, is easy to address…

  • You can logout, where you can log back in with your preferred Username and password.
  • You can switch to another User within the same logged in session by “su” (does not change environmental variables like your home directory and “su -” which properly logs you in with the new User’s environmental variables, so recommend
su - *new_username *

Also an FYI
Many might prefer to add a User using YaST instead of the command line to more granularly configure things like user groups, password policy, etc.


It’s not completely clear what you are describing. It is usually helpful if you post the exact command that you used.

For me, “su” works fine for changing to another user. So I would guess that something went wrong in the “useradd” so that either the new user doesn’t exist or there is something broken about that new user.

Thanks for the advise the problem was apperently not the the created user directed me to the root account. It just made it look so because I changed the /etc/profile.d/alias.bash file with the PS1="\033[1;31m]###ROOT###\w:# \033[1;31m]" entry. So apparently every user I create now will look like my root user but is a regular user. Pretty stupid mistake but thanks anyways for your help!