48

I have created a new user by using useradd command e.g.:

sudo useradd acreddy

Then new user is created but it is asking for a password what is the password?

heemayl
  • 90,425
  • 20
  • 200
  • 267
a-c-sreedhar-reddy
  • 657
  • 1
  • 5
  • 9
  • 4
    Start using `adduser` instead of `useradd` – heemayl Nov 09 '15 at 05:33
  • 12
    There is no default password. When you create a user it does not have a password yet, so you cannot login with that username until you create a password. There is one other way to act as a new user without its password. As root type `su - acreddy`. It will not ask for password and you will be logged in as acreddy. But only in that terminal. – nobody Nov 09 '15 at 06:37
  • 1
    @nobody it still asked me for the password even with `-` – Dan M. May 29 '18 at 12:46
  • 3
    @DanM. You have to be root. So try `sudo -i` to switch to root. Then try `sudo - `. – nobody May 30 '18 at 13:55

2 Answers2

49

You need to set a password for the user. Use the passwd command:

Usage: passwd [options] [LOGIN]

So if you want to set a password for the new user, you type in:

sudo passwd acreddy 

and you're good.

muru
  • 193,181
  • 53
  • 473
  • 722
Neil
  • 4,415
  • 3
  • 21
  • 34
6

If you don't want to set password, you can do it by

passwd -d username
Smart Manoj
  • 167
  • 1
  • 5