Sponsored Content
Operating Systems HP-UX pwage-hpux-T for Trusted HPUX servers Post 302507533 by sparcguy on Thursday 24th of March 2011 06:27:53 AM
Old 03-24-2011
pwage-hpux-T for Trusted HPUX servers

I'm sharing this in case anybody needs it. Modified from the original solaris pwage script. This modified hpux script will check /etc/password file on hpux trusted systems search /tcb and grep the required u_succhg field. Calculate days to expiry and notify users via email.

original solaris pwage script: https://www.unix.com/shell-programmin...sword-age.html


for the hpux script you need to modify following

/etc/passwd file needs to have a "+email@domain.com" in the description field. You can use '+' or any other symbol but not sure if you can use another ':'

aixguy:*:114:106:aix administrator +aixguy@unix.com:/home/aixguy:/usr/bin/sh
hpuxguy:*:103:106:hpux admin +hpuxguy@unix.com:/home/hpuxguy:/usr/bin/sh
sparcguy:*:112:106:solaris administrator +sparcguy@unix.com:/home/sparcguy:/usr/bin/ksh


MAXAGE=90 <-- we use 90 day expiry policy modify for yours.

Quote:
#! /bin/sh
for i in `cat /etc/passwd | grep \@ | sed 's/:/+/g' | cut -d+ -f1`
do
Quote:
for j in `find /tcb -name $i -exec ls -1 {} \;`
do
LASTPWCHG=`cat $j | grep u_succhg | sed 's/:/#/g' | cut -d# -f3`
DAYSEC=`echo "60*60*24" | bc`
DAWNOFTIME=`/usr/contrib/bin/perl -e 'print int(time)'`
SECSAGO=`echo "$DAWNOFTIME - $LASTPWCHG" | bc`
DAYSAGO=`echo $SECSAGO/$DAYSEC | bc`
done
MAXAGE=90
LEFTDAYS=`echo "$MAXAGE - $DAYSAGO" | bc`

if [[ "$LEFTDAYS" = 7 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Your unix id $i will expire in $LEFTDAYS days" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi

if [[ "$LEFTDAYS" = 3 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Your unix id $i will expire in $LEFTDAYS days" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi

if [[ "$LEFTDAYS" -lt 0 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Please note that your unix id $i has aleaady expired" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi
done
If you want to test modify MAXAGE=0 or 10

do not run against un-trusted hpux boxes
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

HPUX 10.20 et HPUX 11

Is there any problems of binaries compatibility between HPUX 10.20 et 11 ? (2 Replies)
Discussion started by: Olivier
2 Replies

2. HP-UX

HPUX any help

:( i got couple of weeks ago a : HP Visualize workstation , model B100. everithing is ok in the box the only problem is that i 'am not familiar with this operational sys, and i try to uninstall and see if i can get on it windows net server 64 bit. or any other 64 bit operational sys that i'll... (1 Reply)
Discussion started by: newbird
1 Replies

3. UNIX for Dummies Questions & Answers

New to HPUX

Hi, I am a SAP Basis admin recentely been asked to administer a HPUX server. Could someone recommend some good study material to learn with the Sap prespective. -carry (1 Reply)
Discussion started by: carryclare
1 Replies

4. UNIX and Linux Applications

RPM For HPUX

Hi can any tell where we can get RPM files for HPUX OS RPM file can be of any application ,it should be succesfully installed in the machine Regards Harish Kumar :confused: (2 Replies)
Discussion started by: harishkumar
2 Replies

5. Shell Programming and Scripting

Need Script to Use CPUs on a HPUX server to simulate Workload Manager on HPUX.

I am running HPUX and using WLM (workload manager). I want to write a script to fork CPUs to basically take CPUs from other servers to show that the communication is working and CPU licensing is working. Basically, I want to build a script that will use up CPU on a server. Any ideas? (2 Replies)
Discussion started by: cpolikowsky
2 Replies

6. Shell Programming and Scripting

hpux vi

Hello. I cant figure out how can i move entire row up , so it pasted on the one above at the end , or to do that for one character. In notepads,word, or some other text editors we would do that with backspace button. Example. Content of my text file is this : I am trying to do that. And... (2 Replies)
Discussion started by: tonijel
2 Replies

7. UNIX and Linux Applications

Stop samba from querying trusted domain servers

Hi, We've got a samba server running in our DMZ. Our users drag & drop files on it for vendors. Everything was working perfectly until the powers that be decided to build a trust between a couple of internal domains. Samba is now querying each server in the trust. When a user browses... (5 Replies)
Discussion started by: mph
5 Replies

8. AIX

pwage-aix for IBM AIX servers

This is the password aging script for aix just completed. So far tested and still testing on one of our aix server running 5.3.0.0. So anyway as you can see it is very similar to pwage-hpux-T the only difference on aix /etc/passwd file looks in this format. Also for this script to work you need to... (0 Replies)
Discussion started by: sparcguy
0 Replies

9. Shell Programming and Scripting

Hpux

Hello All Why is hpux is not much spoken in the unix/Linux platform. what is the disadvantes in HPUX Thanks, VJ (1 Reply)
Discussion started by: Vijaykannan T
1 Replies

10. HP-UX

From a C++ application how to find if a hpux host is in standard mode or trusted mode

is there a way for my C++ application to find out which mode the hpux OS is running in? standard mode or trusted mode. (3 Replies)
Discussion started by: einsteinBrain
3 Replies
smmaillist(1M)						  System Administration Commands					    smmaillist(1M)

NAME
smmaillist - manage email alias entries SYNOPSIS
/usr/sadm/bin/smmaillist subcommand [ auth_args] -- [subcommand_args] DESCRIPTION
The smmaillist command manages one or more email alias entries for the appropriate files in the local /etc files name service or a NIS or NIS+ name service. subcommands smmaillist subcommands are: add Creates a new email alias definition and adds it to the appropriate files. To add an entry, the administrator must have the solaris.admin.usermgr.write authorization. delete Deletes an email alias entry. You can delete only one entry at a time. To delete an entry, the administrator must have the solaris.admin.usermgr.write authorization. Note: You cannot delete Postmaster or Mailer-Daemon aliases. list Lists one or more email alias entries. To list an entry, the administrator must have the solaris.admin.usermgr.read autho- rization. modify Modifies an email alias entry. To modify an entry, the administrator must have the solaris.admin.usermgr.write authoriza- tion. OPTIONS
The smmaillist authentication arguments, auth_args, are derived from the smc(1M) arg set and are the same regardless of which subcommand you use. The smmaillist command requires the Solaris Management Console to be initialized for the command to succeed (see smc(1M)). After rebooting the Solaris Management Console server, the first Solaris Management Console connection might time out, so you might need to retry the command. The subcommand-specific options, subcommand_args, must come after the auth_args and must be separated from them by the -- option. auth_args The valid auth_args are -D, -H, -l, -p, -r, and -u; they are all optional. If no auth_args are specified, certain defaults will be assumed and the user may be prompted for additional information, such as a password for authentication purposes. These letter options can also be specified by their equivalent option words preceded by a double dash. For example, you can use either -D or --domain with the domain argu- ment. -D | --domain domain Specifies the default domain that you want to manage. The syntax of domain is type:/host_name/domain_name, where type is nis, nisplus, dns, ldap, or file; host_name is the name of the machine that serves the domain; and domain_name is the name of the domain you want to manage. (Note: Do not use nis+ for nisplus.) If you do not specify this option, the Solaris Management Console assumes the file default domain on whatever server you choose to man- age, meaning that changes are local to the server. Toolboxes can change the domain on a tool-by-tool basis; this option specifies the domain for all other tools. -H | --hostname host_name:port Specifies the host_name and port to which you want to connect. If you do not specify a port, the system connects to the default port, 898. If you do not specify host_name:port, the Solaris Management Console connects to the local host on port 898. You may still have to choose a toolbox to load into the console. To override this behavior, use the smc(1M) -B option, or set your console preferences to load a "home toolbox" by default. -l | --rolepassword role_password Specifies the password for the role_name. If you specify a role_name but do not specify a role_password, the system prompts you to sup- ply a role_password. Passwords specified on the command line can be seen by any user on the system, hence this option is considered insecure. -p | --password password Specifies the password for the user_name. If you do not specify a password, the system prompts you for one. Passwords specified on the command line can be seen by any user on the system, hence this option is considered insecure. -r | --rolename role_name Specifies a role name for authentication. If you do not specify this option, no role is assumed. -u | --username user_name Specifies the user name for authentication. If you do not specify this option, the user identity running the console process is assumed. -- This option is required and must always follow the preceding options. If you do not enter the preceding options, you must still enter the -- option. subcommand_args Note: Descriptions and other arg options that contain white spaces must be enclosed in double quotes. o For subcommand add: -a address1 -a address2 . . . (Optional) Specifies the new email address. See sendmail(1M). -h (Optional) Displays the command's usage statement. -n alias_name Specifies the name of the alias you want to add. See sendmail(1M). o For subcommand delete: -h (Optional) Displays the command's usage statement. -n alias_name Specifies the alias you want to delete. o For subcommand list: -h (Optional) Displays the command's usage statement. -n alias_name (Optional) Specifies the name of the alias you want to display. If you do not specify an alias, all aliases are listed. o For subcommand modify: -a address1 -a address2 . . . (Optional) Specifies new email address(es) to replace the existing one(s). See sendmail(1M). -h (Optional) Displays the command's usage statement. -n alias_name (Optional) Specifies the name of the alias you want to modify. -N new_alias_name Specifies the new alias name. Use only when renaming an alias. See sendmail(1M). EXAMPLES
Example 1: Creating an alias The following creates the coworkers alias and adds the following member list: bill@machine1, sue@machine2, and me@machine3 to the alias. ./smmaillist add -H myhost -p mypasswd -u root -- -n coworkers -a bill@machine1 -a sue@machine2 -a me@machine3 Example 2: Deleting a mail alias The following deletes the my_alias alias: ./smmaillist delete -H myhost -p mypasswd -u root -- -n my_alias Example 3: Displaying members of a mail alias The following displays the list of members belonging to the my_alias alias: ./smmaillist list -H myhost -p mypasswd -u root -- -n my_alias Example 4: Displaying members of all mail aliases The following displays the list of members belonging to all mail aliases: ./smmaillist list -H myhost -p mypasswd -u root -- Example 5: Renaming a mail alias The following renames the current_name mail alias to new_name: ./smmaillist modify -H myhost -p mypasswd -u root -- -n current_name -N new_name Example 6: Redefining an address list The following changes the recipients of the alias my_alias to bill@machine1. Any previous recipients are deleted from the alias. ./smmaillist modify -H myhost -p mypasswd -u root -- -n my_alias -a bill@machine1 ENVIRONMENT VARIABLES
See environ(5) for a description of the JAVA_HOME environment variable, which affects the execution of the smmaillist command. If this environment variable is not specified, the /usr/java location is used. See smc(1M). EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 Invalid command syntax. A usage message displays. 2 An error occurred while executing the command. An error message displays. FILES
The following files are used by the smmaillist command: /var/mail/aliases Aliases for sendmail(1M). See aliases(4). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWmga | +-----------------------------+-----------------------------+ SEE ALSO
sendmail(1M), smc(1M), aliases(4), attributes(5), environ(5) SunOS 5.10 5 Jan 2001 smmaillist(1M)
All times are GMT -4. The time now is 11:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy