Operating System - HP-UX
1833159 Members
3295 Online
110051 Solutions
New Discussion

Re: How can I expire the user in /etc/passwd

 
lin.chen
Frequent Advisor

How can I expire the user in /etc/passwd

Some users in /etc/passwd is invalid.
Shoud I just add "#" at the beginning of the entry.
#ll test.log
-rw-rw-rw- 1 #ff users 202 Sep 21 00:22 test.log

Or #passwd -l ff

Could you give me some advice?
Regards,Louis
5 REPLIES 5
Dave Hutton
Honored Contributor

Re: How can I expire the user in /etc/passwd

No, you don't want to comment out anything in the password file.

Is your password file trusted or untrusted?
Geoff Wild
Honored Contributor

Re: How can I expire the user in /etc/passwd

passwd -l ff


If you want to edit the passwd file, then use:
vipw

Also - you could just delete them with userdel

Rgds...Geofff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Dennis Handly
Acclaimed Contributor

Re: How can I expire the user in /etc/passwd

There are no comments in /etc/passwd.
If you want to keep their UID, you should just add a "*" at the start of their password.

You can also add a "_" to the name to indicate to you that that name is expired, when you list a file.
Robert-Jan Goossens
Honored Contributor

Re: How can I expire the user in /etc/passwd

Hi Louis,

From the man passwd.

-l Lock user account. In untrusted mode this replaces the encrypted password with *.

# passwd -l user

Regards,
Robert-Jan
James R. Ferguson
Acclaimed Contributor

Re: How can I expire the user in /etc/passwd

Hi:

The manpages for 'passwd' would help you. If you want to lock the user, use 'passwd -l'. If you want to simply force the user to change his/her password at the next login, use 'passwd -f'.

Regards!

...JRF...