crystal reports barcode formula if [ "`id -un`" != "root" ]; then echo "This script must be run as root - exiting" >&2 exit 1 fi in Font

Encoding ECC200 in Font if [ "`id -un`" != "root" ]; then echo "This script must be run as root - exiting" >&2 exit 1 fi

if [ "`id -un`" != "root" ]; then echo "This script must be run as root - exiting" >&2 exit 1 fi
Printing DataMatrix In None
Using Barcode creator for Font Control to generate, create ECC200 image in Font applications.
www.OnBarcode.com
Barcode Encoder In None
Using Barcode creation for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
CHAPTER 36 PASSWORD-AGING NOTIFICATION
Printing PDF417 In None
Using Barcode creator for Font Control to generate, create PDF 417 image in Font applications.
www.OnBarcode.com
USS Code 128 Generator In None
Using Barcode creation for Font Control to generate, create Code 128B image in Font applications.
www.OnBarcode.com
Then we have to clean up any old transient report files that exist.
QR Code 2d Barcode Drawer In None
Using Barcode drawer for Font Control to generate, create QR Code 2d barcode image in Font applications.
www.OnBarcode.com
Paint GS1 - 12 In None
Using Barcode maker for Font Control to generate, create GTIN - 12 image in Font applications.
www.OnBarcode.com
for file in $OUTFILE $WARNOUT $NOTEOUT $REPORT do if [ -f $file ] then rm $file fi done
Make Code39 In None
Using Barcode generator for Font Control to generate, create Code 3 of 9 image in Font applications.
www.OnBarcode.com
ISSN - 10 Creator In None
Using Barcode generator for Font Control to generate, create ISSN image in Font applications.
www.OnBarcode.com
Next we determine the number of days that have passed since 1/1/1970. Passwordaging information in the /etc/shadow file is held in the third field of each account entry. This field contains an integer that expresses the date on which the password was last changed as a number of days since 1/1/1970. Subtracting this number from the current number of days elapsed since that date gives us the age of the password.
Recognizing DataMatrix In Visual Basic .NET
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Data Matrix ECC200 Printer In VS .NET
Using Barcode creation for ASP.NET Control to generate, create DataMatrix image in ASP.NET applications.
www.OnBarcode.com
seconds_since_epoch=$((`date +%s`)) seconds_per_day=86400 days_since_epoch=$(($seconds_since_epoch/$seconds_per_day))
Creating UCC.EAN - 128 In VS .NET
Using Barcode printer for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
www.OnBarcode.com
Create Universal Product Code Version A In None
Using Barcode generator for Microsoft Word Control to generate, create UCC - 12 image in Microsoft Word applications.
www.OnBarcode.com
We now back up the shadow file for safety. We want to be able to return to the original file to start over if necessary. Using cp -p will also preserve the original modification time and permissions on the new copy of the file.
Code 128 Creator In Java
Using Barcode encoder for BIRT reports Control to generate, create Code 128 Code Set B image in Eclipse BIRT applications.
www.OnBarcode.com
Painting Barcode In .NET Framework
Using Barcode encoder for Visual Studio .NET Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
backdate=`date +%m%d%y%H%M` cp -p $shad $ARCHIVE/shadow.$backdate
Barcode Creation In .NET Framework
Using Barcode creator for Reporting Service Control to generate, create Barcode image in Reporting Service applications.
www.OnBarcode.com
Linear 1D Barcode Maker In VS .NET
Using Barcode creator for .NET Control to generate, create Linear 1D Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
The following code lets you clean the archive directory by removing old reports and backup shadow files more than seven days old.
Generate 2D Barcode In Java
Using Barcode generation for Java Control to generate, create 2D image in Java applications.
www.OnBarcode.com
Code 128B Creation In Objective-C
Using Barcode printer for iPad Control to generate, create Code 128 image in iPad applications.
www.OnBarcode.com
find $ARCHIVE -mtime +7 -exec rm {} \;
Generating QR Code 2d Barcode In None
Using Barcode printer for Microsoft Excel Control to generate, create Quick Response Code image in Office Excel applications.
www.OnBarcode.com
UPC-A Supplement 2 Printer In None
Using Barcode maker for Software Control to generate, create UPC A image in Software applications.
www.OnBarcode.com
Processing Begins
Now here is where the real script begins. We start a loop that iterates through all the usernames in the passwd file.
for user in `cut -d: -f1 $pswd` do
To line up the text in the final report in columns and make it a little more readable, you might like to create some padding spaces based on the length of the username to be reported.
padding="" user_length=`echo $user | awk '{print length}'` padding_len=$((15-$user_length)) counter=1
CHAPTER 36 PASSWORD-AGING NOTIFICATION
while [ $counter -lt $padding_len ] do padding="${padding} " counter=$(($counter+1)) done
The code would also benefit from using printf to format the report appropriately instead of inserting spaces manually to line up the columns. The printf command is a print function that gives you a lot of control over how the output is formatted. Next we populate some variables with the values from the current user s shadow entry. First is the number of days after which the user must change his password. The second is the number of days since January 1, 1970 that the password was last changed. These will be used to determine when an account should expire.
exp_days=`grep "^${user}:" $shad | cut -d: -f5` pass_days=`grep "^${user}:" $shad | cut -d: -f3`
Depending on whether the encrypted password is located in the passwd or the shadow file, you have to use one of the following two lines:
#pass_word=`grep "^${user}:" $pswd | cut -d: -f2` pass_word=`grep "^${user}:" $shad | cut -d: -f2`
Our implementation uses the second (uncommented) line; it gets its data from the shadow file. You probably think the script could simply check for the existence of the shadow file; in case it isn t there, it should default to the passwd file. This would work in most but not all situations. I have worked on some machines that have both files but use only the /etc/passwd. I have also seen systems that will use the /etc/passwd file unless an /etc/ shadow exists. In that case the shadow file will be used. This script will, of course, need to be customized to fit your environment. You also need to check for a special case: if the encrypted password consists of a single asterisk (*) character, you have to escape it with a backslash (\). If the asterisk isn t escaped, it will be evaluated later as a wild card denoting all filenames residing in the current working directory (the traditional meaning of *). In a shell environment, another method to get around this problem would be to set noglob, which turns off that type of evaluation.
if [ "$pass_word" = "*" ] then pass_word="\*" fi
If the user account is incorrectly configured with a null password, the script creates a message explaining this state of affairs and appends it to the warning-output file. The contents of this file will be added to the final report at a later stage.
CHAPTER 36 PASSWORD-AGING NOTIFICATION
if [ "$pass_word" = "" ] then echo "$user $padding WARN: $user has null password set, \ set password or lock account" >> $WARNOUT fi
Then we determine by checking the exclude file whether the current user is one of those exempted from password expiration. If the user is not exempt from password expiration, the script continues on to the core of the program.
Copyright © OnBarcode.com . All rights reserved.