14

I've often created temporary passwords for users for my own development machine for initial id creation.

For other environments, I've seen admins have the ability to have a password show as expired immediately, forcing me to change my password on first login.

How does one do this? (In this specific case I am using RHEL, but I'm hoping this information is universal across all/most linux distros)

2 Answers 2

17

You can use the command

chage -d 0 [username]

to change the users expiration date, forcing them to change their password on first log in.

You can read more about it in the man pages for chage and usermod.

11

There is a switch for passwd, -e. From the manpage (man passwd):

-e, --expire Immediately expire an accounts password. This in effect can force a user to change his/her password at the users next login.

So

 sudo passwd -e LOGIN 

should do it.

From the comments, I know that there is more variation than what I expected. So this is an Xubuntu 10.04 installation, and this is, what file reports:

file $(which passwd)
/usr/bin/passwd: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
2
  • Interesting, my passwd doesn't have this option. I will still note this as well though. Which linux distro did this passwd come from?
    – user606723
    Apr 9, 2012 at 19:49
  • You're right. I way too often forget to mention what I'm using. I added more information. Apr 9, 2012 at 20:54

You must log in to answer this question.

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