This question already has an answer here:

Is there a way to create a new standard user, who can log in immediately? When I create users through a shell script, the users do get created, but they are disabled. Is there are way to create them so that they can log in without additional actions?

I use Ubuntu 16.04

marked as duplicate by George Udosen, Wilf, WinEunuuchs2Unix, Zanna command-line May 14 '17 at 5:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    what do you mean they are disabled? what command are you using to create them? – Zanna May 13 '17 at 16:55
  • @Zanna I think his using the old useradd where no password is given to the user hence the user is disable until a password is set... – George Udosen May 13 '17 at 16:58
  • 1
    seems likely @George :) if so question is sure to be a duplicate. Right now it's just unclear – Zanna May 13 '17 at 17:01
  • Pass in the -p user_password option in the script that should solve the problem – George Udosen May 13 '17 at 17:15
  • Also saw this neat trick echo username:new_password | chpasswd here: stackoverflow.com/questions/2150882/…. Like this one as it encrypts the password – George Udosen May 13 '17 at 17:17

Since you can create a user then your script works, now use the chpasswd tool to create a password for your users as without this, they won't be able to sign in after creation.

echo username:username | chpasswd



Not the answer you're looking for? Browse other questions tagged or ask your own question.