how to force a user to change the password

RHEL 5 update 4. How to force a user to change the password at his next logon.

Thanks in advance.

You can force a password to immediately expire with

chage -d 0 username

why I'm not works.
when we use option -d , user cannot login(rhel5.2, ssh4.3).

Did they ever have a password before? If not, you need to create one for them. This will not force their first password.

It have password, but still not works. ???

==================
# grep ratcha /etc/passwd /etc/shadow
/etc/passwd:ratcha.c:x:510:500:System Admin:/home/ratcha.c:/bin/ksh
/etc/shadow:ratcha.c:$1$O1z5V6.2$en8cRSXbDS0VGAT/XHbEZ/:14515:7:90:7:::
# passwd -d ratcha.c
Removing password for user ratcha.c.
passwd: Success
#
# grep ratcha /etc/passwd /etc/shadow
/etc/passwd:ratcha.c:x:510:500:System Admin:/home/ratcha.c:/bin/ksh
/etc/shadow:ratcha.c::14515:7:90:7:::
# ssh ratcha.c@localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is e6:6b:cd:ce:7c:c2:60:f5:22:f8:23:ac:f0:8b:ae:f6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
ratcha.c@localhost's password:
Permission denied, please try again.
ratcha.c@localhost's password:
Permission denied, please try again.
ratcha.c@localhost's password:
Permission denied (publickey,gssapi-with-mic,password).

Chage -d should work. Can you log in as that user on the console?

User can log in to server normally.
But I want to test force them to change password at first login.

Why option -d not work for me ???

Using the -d option disables or removes a user password. The man page on passwd shows the -d option as disable a password.

You probably should use the -f option (force password change).

passwd -f ratcha.c

I have tested on RHEL 5.3 and below is working fine.

echo "Creating a user account for arm_naja"
useradd arm_naja

echo arm_naja"1234"|passwd --stdin arm_naja
echo "User arm_naja password changed!"

echo arm_naja|chage -d 0 arm_naja
echo "User arm_naja will be forced to change password on next login!"