- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Notifying Users of Mandatory Password Changes
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 12:31 AM
тАО12-20-2006 12:31 AM
Notifying Users of Mandatory Password Changes
Is there a script that would notify users that they need to change their passwords within a given timeframe? I know chage will check individual user accounts, but can it be used to check all user accounts and have the results either e-mailed to the administrator or to the various users? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 01:10 AM
тАО12-20-2006 01:10 AM
Re: Notifying Users of Mandatory Password Changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 01:15 AM
тАО12-20-2006 01:15 AM
Re: Notifying Users of Mandatory Password Changes
Thanks for your reply. The accounts in question are all local to the machine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 04:34 AM
тАО12-20-2006 04:34 AM
Re: Notifying Users of Mandatory Password Changes
users=`grep -v ":\!\!:" /etc/shadow|grep -v ":\*:" |grep -v root|cut -f1 -d:`
expire_time=90
today=$(( `perl -le 'print time'` / 86400 ))
for user in $users ; do
last_change=$(( `grep $user /etc/shadow |cut -f3 -d:` ))
days_left=$(( $expire_time - $today + $last_change ))
if [ $days_left -lt 15 -a $days_left -ge 0 ]; then
user_mail=`grep $user /etc/passwd|cut -f5 -d: `
# echo
# echo "ATTENTION: The password of $user will expire in $days_left days.\n"
mail -s "Your password on xxx system will expire in $days_left" $user_mail << EOF
Hello,
Your password of account $user, which is used for accessing xxx server on
host `uname -n`, will expire in $days_left days.
Please update your password.
Thanks for your support!
EOF
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 07:16 AM
тАО12-20-2006 07:16 AM
Re: Notifying Users of Mandatory Password Changes
I created the script according to the text that your posted in the forum. When I ran the script a series of messages appeared indicating problems sending to the address
What changes should I make to correct this? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 07:59 AM
тАО12-20-2006 07:59 AM
Re: Notifying Users of Mandatory Password Changes
The format and contents of the fifth field (one-relative) of '/etc/passwd' is left to an administrator's discretion. George's script appears to assume that the fifth field contains a string that represents a valid email address. Your 'passwd' database apparently does not follow this convention.
You can simply create mail to the account on the server that you are examining with this change:
...
if [ $days_left -lt 15 -a $days_left -ge 0 ]; then
mail -s "Your password on xxx system will expire in $days_left" $user << EOF
Hello,
Your password of account $user, which is used for accessing xxx server on
host `uname -n`, will expire in $days_left days.
Please update your password.
Thanks for your support!
EOF
...Note that I dropped the line:
user_mail=`grep $user /etc/passwd|cut -f5 -d: `
...and used ${user} in lieu of ${user_mail} for the mail account.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 08:20 AM
тАО12-20-2006 08:20 AM
Re: Notifying Users of Mandatory Password Changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 07:12 PM
тАО12-20-2006 07:12 PM