- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: password aging using a script
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
Forums
Discussions
Discussions
Discussions
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
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
05-14-2001 12:08 PM
05-14-2001 12:08 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 12:30 PM
05-14-2001 12:30 PM
Re: password aging using a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 12:34 PM
05-14-2001 12:34 PM
Re: password aging using a script
for user in `/sbin/cat /tmp/pass2change`
do
/sbin/passwd -f -x 42 -n 35 $user
echo "changing expiration time for $user to 45 days"
done
rm /tmp/pass2change
-f is force at next login
-x is max days before have to change
-n is max days between changes
see man passwd for other options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 12:37 PM
05-14-2001 12:37 PM
Re: password aging using a script
I had a shell script which invokes an awk script which was already very close; I modified it for your values and also it does not alter passwd's for users with uid < MIN_UID. You will need to set that value. NOTE: the actual passwd call is commented out so that you can test first. Please see the attachment.
Enjoy, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 12:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2001 12:53 PM
05-14-2001 12:53 PM
Re: password aging using a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 01:27 AM
05-15-2001 01:27 AM
Re: password aging using a script
LOGFILE=/tmp/check_passwd_log.$$
EXPIRE=30
TODAY=$(date +%.1j)
YEAR=$(date +%E)
function NOPASS {
DATE=$(date +%d/%m/%y" "%H:%M)
echo "$DATE $USER - Password already awaiting update by user" >> $LOGFILE
}
function NOCHNG {
DATE=$(date +%d/%m/%y" "%H:%M)
echo "$DATE $USER - Password last changed $LYEXP days ago - No action" >> $LOGFILE
}
function EXPPASS {
DATE=$(date +%d/%m/%y" "%H:%M)
echo "$DATE $USER - Password last changed $LYEXP days ago - Forcing change" >> $LOGFILE
echo "passwd -f $USER" >> $LOGFILE
passwd -f $USER
}
# Exclude some users from change (alternate procedure in place)
for USER in $(cut -d":" -f1 /etc/passwd | egrep -v '(root|informix)')
do
EXPYEAR=$(/usr/lbin/getprpw -r -m spwchg $USER| tr -s " "|cut -d" " -f5)
EXPMONTH=$(/usr/lbin/getprpw -r -m spwchg $USER| tr -s " "|cut -d" " -f2)
EXPDAY=$(/usr/lbin/getprpw -r -m spwchg $USER| tr -s " "|cut -d" " -f3)
case $EXPMONTH in
Jan) EXPM=0;;
Feb) EXPM=31;;
Mar) EXPM=58;;
Apr) EXPM=89;;
May) EXPM=119;;
Jun) EXPM=150;;
Jul) EXPM=180;;
Aug) EXPM=211;;
Sep) EXPM=242;;
Oct) EXPM=272;;
Nov) EXPM=303;;
Dec) EXPM=333;;
*) echo $EXPMONTH invalid;exit;;
esac
if [ $EXPYEAR = "1970" ]
then
NOPASS
continue
fi
integer x=$EXPM y=$EXPDAY z=$EXPIRE
let EXP=x+y
if [ $EXPYEAR -lt $YEAR ]
then
# Action to perform if last update was in previous year
let LYEXP=365-$EXP+$TODAY
if [ $LYEXP -ge $EXPIRE ]
then
EXPPASS
else
NOCHNG
fi
else
# Action to perform if last update was in current year
let LYEXP=$TODAY-$EXP
if [ $LYEXP -ge $EXPIRE ]