54

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
  • 94,145
  • 4
    Start using adduser instead of useradd – heemayl Nov 09 '15 at 05:33
  • 14
    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
  • 2
    @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 - <username>. – nobody May 30 '18 at 13:55

2 Answers2

52

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
  • 207,970
Neil
  • 4,585
  • 3
  • 23
  • 34
8

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

passwd -d username