1828202 Members
1855 Online
109975 Solutions
New Discussion

Script input

 
SOLVED
Go to solution
Charles Keyser
Frequent Advisor

Re: Script input

Thanks everyone for your help. Below is what I ended with and it works great. The command looks at the user, resets the password lifetime expired if needed then generates a temp password and displays on the screen, the sleep 10, is set to allow the Help Desk to write the number down and pass it on to the user, in turn they (user) can logon and rest their password

The last step of this is to add the script to the 3 servers I have and allow the Help Desk to logon using sudo. The next in the tread will be asking "How do I set the Help Desk up as a sudo user to have root access for this script" The password resets need to have root access. I have set up local users in the sudoers, any thoughts or ideas would be apperciated


5) echo "Username to modify \c"; read USER
TESTUSER=`awk -v USER=${USER} -F: '$1~USER { print $1 }' /etc/passwd`
if test "${USER}" != "${TESTUSER}"
then
echo "${USER} is invalid!"
echo "Press [ENTER] to continue. \c"
read NOTHING
else
#This command looks at the account if it has a password liftime expired it will reset the account and enable it and resets pasword
/usr/lbin/modprpw -x ${USER}
sleep 10
James R. Ferguson
Acclaimed Contributor

Re: Script input

Hi Charles:

You *need* to *change*:

TESTUSER=`awk -v USER=${USER} -F: '$1~USER { print $1 }' /etc/passwd`

...to:

TESTUSER=`awk -v USER=${USER} -F: '$1==USER { print $1 }' /etc/passwd`

...per my previous post citing my own boo-boo.

Regards!

...JRF...
Charles Keyser
Frequent Advisor

Re: Script input

Great, changed and tested, outstanding

Question about sudoers If I add the Help Desk in to the sudoers file (see below).
Will this allow then to run the script with root privileges or do I need to add
/usr/lbin/modprpw -x
In the sudoers file allowing the Help Desk authorization to run this as root?

drt9986 ALL=(ALL) NOPASSWD: ALL
cjk1402 ALL=(OP) NOPASSWD: ALL
jhf1366 ALL=(OP) NOPASSWD: ALL
HelpDesk ALL=(OP) NOPASSWD: ALL