Generate Random MAC Address
by dervish on Nov.11, 2010, under Linux, Networking
From a Linux BASH command line:
openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’
Example:
[neo@trinity ~]$ openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’
28:97:1c:70:73:4d
20100913: adddirs.sh
by dervish on Sep.13, 2010, under Linux, Scripts
#!/bin/sh
#20100913 – Add log directories to get total log space
for x in `cat linux.servers`
do
echo $x:
R=`ssh $x sudo du -h /var/log | tail -1`
N=`echo $R | cut -f1 -dM`
sum=$(($COUNT + $N))
COUNT=$sum
echo $COUNT $N
echo
done
20100421: changelin.sh
by dervish on Apr.21, 2010, under Linux, Scripts
#!/bin/sh
# 20100421 – Created by Jamey Hopkins
echo
echo “Change Users Linux/AIX Password”
echo
if [ “$1” = “” ]
then
echo need server list
echo example: $0 servers.txt
echo
exit
fi
if [ ! -f $1 ]
then
echo “Server list $1 not found.”
echo
exit
fi
echo -n “Enter Users Login: ”
read LOGIN
echo “Enter new password”
echo -n “Password: ”
stty -echo
read PASS1
stty echo
echo
echo “Enter password again”
echo -n “Password: ”
stty -echo
read PASS2
stty echo
echo
if [ “$PASS1” != “$PASS2” ]
then
echo passwords did not match
exit
fi
LIST=$1
echo “$LOGIN:$PASS1” >account.info
for X in `cat $LIST`
do
echo Performing Password Change for $LOGIN on $X
scp ./account.info $X: >/dev/null
ssh $X “cat account.info | sudo /usr/sbin/chpasswd” >/dev/null
ssh $X rm account.info
done
rm account.info
20100421: changeilom.sh
by dervish on Apr.21, 2010, under Linux, Scripts
#!/bin/sh
# 20100421 – Jamey Hopkins
echo
echo “Change root password on Sun ILOM cards”
echo
if [ “$1” = “” ]
then
echo need server list
echo example: changeilom.sh servers.txt
exit
fi
if [ ! -f $1 ]
then
echo “Server list $1 not found.”
echo
exit
fi
echo “Enter new password”
echo -n “Password: ”
stty -echo
read PASS1
stty echo
echo
echo “Enter password again”
echo -n “Password: ”
stty -echo
read PASS2
stty echo
echo
if [ “$PASS1” != “$PASS2” ]
then
echo passwords did not match
exit
fi
LIST=$1
echo “user set password 2 $PASS1” >cmnds.ilom
echo “quit” >>cmnds.ilom
for x in `cat $LIST`
do
echo $x
#ssh ${x}.fls ls
scp ./cmnds.ilom ${x}.fls: >/dev/null
echo “Running IPMITOOL”
ssh ${x}.fls “cat cmnds.ilom | sudo ipmitool shell” >/dev/null
ssh ${x}.fls rm cmnds.ilom
done
rm cmnds.ilom
Teach A Man To Fish
by dervish on Apr.16, 2010, under Jokes, Sundry
Give a man a fish; you have fed him for today. Teach a man to fish; and if he doesn’t beat you with the pole, he will resent you for a lifetime.