Force the user to change their password at first login

42,570

Solution 1

You can just expire that password. After creating a new user foo, just type:

sudo chage -d 0 foo

And he will be forced to change it after first logon.

Solution 2

Another option would be to expire the password using passwd:

sudo passwd -e username
Share:
42,570

Related videos on Youtube

qbi
Author by

qbi

Updated on September 17, 2022

Comments

  • qbi
    qbi over 1 year

    When I add a new user to my system I set a password and tell it to the new user. If the user doesn't like it, he/she can change it. However in my opinion it is better to force the user to change his/her password at the first login. Is there a way I can do that in Ubuntu?

  • T.W.R. Cole
    T.W.R. Cole over 8 years
    Why is the subcommand called chage ?
  • kars7e
    kars7e over 8 years
    I'm not sure, but if I was to guess: "ch" prefix comes from word "change". other commands that change something in the system also start with "ch", for example "chmod", "chown", etc. "age" suffix probably comes from the fact that this changes the age of the password - but that's a blind guess.
  • MrD
    MrD about 8 years
    chage stands for "change age", i.e chage command abbreviation is similar to chmod, chown etc.
  • James M
    James M almost 6 years
    this is correct answer