*********************************************************

john's notes

*********************************************************

note: most of these commands are for HP-UX

things to do with awk

check user id's and home directories

cat /etc/passwd | awk -F: '{print $3" " $6}' | sort > sorted.pass.3.6

test login against current userid

if [ `who am i | awk '{print $1}'`=`whoami`] 
then
blah;blah
exit;exit
fi



test to force an su login

case `/usr/bin/who am i | awk '{ print $1 }'` in
    userid)  if [ `/usr/bin/who am i | awk '{ print $1 }'` = `/usr/bin/whoami` ]
                then
                echo "################no#login#########################"
                exit;exit
                fi;;
esac

root-#->HOW-TO-CLEAR-A-USER

# handy way to clear dead sessions and ALL activities of a user # or a process. Puts the kill on each line. # # ps -ef | grep userid > nuke.userid # cat nuke.userid | awk '{ print "kill -9 " $2 }' > nuke # more nuke # sh nuke # w

to view a specific field

awk -F: '{ if ($2 == "") print $1 }' /etc/passwd awk -F: '{ if ($3 == 0) print $1}' /etc/passwd

find all files and other stuff

/usr/bin/find / -user root -perm -4000 -print | tee -a /root/suid.files

(also: can use ncheck to check for suid or
/dev/kmem to check perms
/etc/securetty - restricts root login
COPS - Computer Oracle & Password System
strings may be used to view files
Tripwire)

*********************************************************

john's home page. -- HTML tags page. -- lvm info -- find commands -- nfs example --
System Administration Humor (?):
SysAdmin field guide -- SysAdmin song -- never say... -- email: john@wagoneers.com


Copyright © 1997 John Meister All rights reserved.