Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitoring root in the Password File.

Status
Not open for further replies.

attitude

MIS
Aug 17, 2000
9
0
0
US
I need some help with this script
It errors out on the third line: syntax error at line 3: '(' unexpected

Thanks for any help


#!/bin/sh

for id in 'awk 'FS=":" {if(($3 == 0 && $1 != "root" )) print $1}' /etc/passwd'
do
mail -s &quot;Root Access Alert&quot; root@rocket.foo.com << EOF

############################################################
#
# Alert Login ID 'echo ${id}' has uid 0
# 'date &quot;+Detacted On Date :%D Time :%r&quot;'
#
#
############################################################


EOF
done
 
Try this on line two to three:

for id in nawk 'FS=&quot;:&quot;{if(($3 == 0 && $1 != &quot;root&quot; )){print $1}}' /etc/passwd'

 
Thanks
But it does not like the end of this script?
any reason why?
Help
thanks
 
Well I got it to work, It helps if you use the correct syntax.
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top