To set a password for a new user in Linux, you can use the passwd command. Here’s how to do it:
- Run the following command, replacing
<username>with the name of the user:
sudo passwd <username>
For example, to set a password for a user named "newuser", you would run:
sudo passwd newuser
- You will be prompted to enter a new password twice. Type the password of your choice and press Enter after each entry.
If both passwords match, you will see a confirmation message indicating that the password has been updated successfully.
