If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > check for password expiration

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #16 (permalink)  
Old 11-30-12, 19:59
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,183
Can I add it to db2's crontab (and set SUID/GUID on the script)? I'm not sure if SA team would let me add it to root's crontab.
Reply With Quote
  #17 (permalink)  
Old 11-30-12, 21:15
kitaman kitaman is offline
Programming since 1BC
 
Join Date: Sep 2009
Location: Ontario
Posts: 827
No, if you cannot run it from root, then you must copy chpasswd to /home/db2/bin, change its permissions (see post #7), and make sure that only db2 can get to it. If you just change permissions on the original, then you will have a difficult time preventing its unauthorized use.
Reply With Quote
  #18 (permalink)  
Old 12-01-12, 08:06
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 2,183
I'll give it a try. Thank you!
Reply With Quote
  #19 (permalink)  
Old 12-01-12, 16:24
kitaman kitaman is offline
Programming since 1BC
 
Join Date: Sep 2009
Location: Ontario
Posts: 827
Post 15 was developed on SCO.
On Linux.

Code:
#!/bin/bash                                
i=1                                        
pw1=""                                     
pw2=""                                     
while [ $i -le 8 ]                         
do                                         
#       p=`random 74`                      
        p=$[ ( $RANDOM % 74 )  + 1 ]       
        p=`expr $p + 48`                   
        if [ $p -eq 92 -o $p -eq 96 ]      
        then                               
                p=`expr $p + 1`            
        fi                                 
        pw1=`echo -e "obase = 8\n$p\n"|bc` 
        pw1=`echo -e "\0$pw1\c"`           
        pw2=$pw2$pw1                       
        i=`expr $i + 1`                    
done                                       
#echo $pw2                                  
echo $pw2 >>/home/db2/currentpassword     
echo db2:$pw2 |chpasswd
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On