InitDomain v1.0
Purpose
This BASH script, InitDomain, allows a user to remotely re-initialize the NIS on PINCLAB.
Reason
After changing a password with passwd before that change takes efect for the network the NIS database must be recreated to enable that user to log on. This can be done by the command ypinit -m, which requires several directory changes to execute. Alternately it can be done with yppasswd, which requires the root password even if you are already root. To reduce the number of times the root password must be entered this script does not require it.
Security
In order to run this script you must have UID 0, in other words you must be root to run it. If you attempt to execute it without root privileges it fails logging the date (time, month, day, and year), along with your UID and user name to the flog.ID file. Making it a simple thing to locate illegal uses and identify the intruder's/user's identification.
Code
#! /bin/bash
# Created by Daniel Sellers
uid=`echo $UID`
if [ "$uid" = "0" ]
then
echo " restarting database NOW"
cd /usr/lib/yp
./ypinit -m
else
echo " You are not ROOT try again when you are"
dte=`date`
usr=`echo $USER`
echo "$dte $usr $uid" > temp.ID
cat flog.ID > log.ID.tmp
cat temp.ID log.ID.tmp > flog.ID
rm temp.ID log.ID.tmp
fi
Author
Daniel A. Sellers
CIT Lab Technician ACC Pinnacle
01/14/02