commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Alternately for those without getent or only want to work on local users it's even easier:
cut -d: -f1 /etc/passwd|xargs -n1 passwd -e
Note that not all implementations of passwd support -e. On RH it would be passwd -x0 (?) and on Solaris it would be passwd -f.
There are 2 alternatives - vote for the best!
This assumes that te original's 'passwd -e' forces a user to change password; it doesn't in the versions I have.
If you can do better, submit your command here.
You must be signed in to comment.