Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer

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
share|improve this answer
    
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 '12 at 19:49
    
You're right. I way too often forget to mention what I'm using. I added more information. –  user unknown Apr 9 '12 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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