44

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?

2 Answers 2

57

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.

3
  • 1
    Why is the subcommand called chage ? Oct 20, 2015 at 18:21
  • 3
    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.
    – kars7e
    Oct 22, 2015 at 4:38
  • 4
    chage stands for "change age", i.e chage command abbreviation is similar to chmod, chown etc.
    – MrD
    May 3, 2016 at 12:29
20

Another option would be to expire the password using passwd:

sudo passwd -e username
1
  • 3
    this is correct answer
    – James M
    May 25, 2018 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .