The issue arises because the -p flag in the useradd command expects the pre-encrypted password hash, not the plaintext password. When you use useradd -p "merry", the system attempts to store the string "merry" as the password hash, which is not valid for authentication.
To resolve this issue, follow these steps:
Correctly Set the Password for the User
Use the passwd command to set a proper password for the user after creation:
- 
Create the user without specifying the password in plaintext:
sudo useradd merry - 
Set the password for the user securely:
sudo passwd merryYou’ll be prompted to enter the password for the user. Enter the password (
merry, in your case), and confirm it. 
If You Must Use useradd -p
If you want to use the -p flag with useradd, you must pass an encrypted password hash. You can generate this using the openssl or mkpasswd command.
For example:
openssl passwd -6 merryThis generates a hashed version of the password merry. Use this hash with the -p option:
sudo useradd merry -p '<hashed_password>'Replace <hashed_password> with the hash generated by openssl.
Why Does Authentication Fail?
- 
-pStored a Plain Text Password: The string"merry"was stored as the hash instead of a proper encrypted value, causing authentication to fail. - 
Password Policy Restrictions: Ensure your system doesn’t have password complexity or length requirements that the password
merrymight violate. - 
Account Lockout: Confirm the account isn’t locked or disabled:
sudo passwd -S merryIf it says
locked, unlock the account with:sudo passwd -u merry 
By correctly setting the password or using a hashed password with useradd, you should be able to log in as merry.