This script will configure NIS master server on solaris10
about the script:
- It will set the domain name, which u give
- NIS alternate directory will be created in /mynis folder
- It will copy the configuration files from /etc to /mynis folder
- edit the Makefile and passwd,shadow files then run ypinit -m command for NIS master.
- Start NIS services
Before run the script:
- Login as root
- check proper entries for ip,netmasks,gateway etc.,
- check autofs settings.
My NIS Configuration script
#!/usr/bin/bash
echo "################################"
echo "NIS server Configuration script"
echo "written by G.Rengarajan"
echo "################################"
echo "Backing up Make File"
cp /var/yp/Makefile Makefile.backup
echo "#############################################"
echo "Making New NIS server"
echo "#############################################"
echo "Type Your NIS DOMAIN NAME "
read name
echo $name" > /etc/defaultdomain
echo "Your NIS Domain name is `domainname`"
cat /etc/defaultdomain
echo "##### Making NIS Alternate Directory#####"
mkdir /mynis
mkdir /mynis/etc
mkdir /mynis/etc/security
mkdir /mynis/etc/inet
echo "Copying files from ETC directory to Alternate Directory"
echo "#########################################################"
cp /etc/auto_master /mynis/etc
cp /etc/auto_home /mynis/etc
cp /etc/group /mynis/etc
cp /etc/hosts /mynis/etc
cp /etc/inet/ipnodes /mynis/etc
cp /etc/netmasks /mynis/etc
#cp /etc/netgroup /mynis/etc
cp /etc/networks /mynis/etc
cp /etc/passwd /mynis/etc
cp /etc/shadow /mynis/etc
cp /etc/protocols /mynis/etc
cp /etc/services /mynis/etc
cp /etc/rpc /mynis/etc
cp /etc/user_attr /mynis/etc
cp /etc/publickey /mynis/etc
cp /etc/TIMEZONE /mynis/etc
cp /etc/inet/ipnodes /mynis/etc/inet
cp /etc/security/audit_user /mynis/etc/security
cp /etc/security/auth_attr /mynis/etc/security
cp /etc/security/exec_attr /mynis/etc/security
#I dont have following files so i`m creating empty file
touch /mynis/etc/ethers
touch /mynis/etc/bootparams
touch /mynis/etc/security/prof_attr
touch /mynis/etc/netgroup
touch /mynis/etc/timezone
echo "Configuration Files are copied to Alternate Directory"
echo "Adding entry to Makefile"
echo "***************************"
cat Makefile sed 's!^DIR =.*!DIR =/mynis/etc!g;s!^INETDIR=.*!INETDIR=/mynis/e
tc/inet!g;s!^RBACDIR=.*!RBACDIR=/mynis/etc/security!g;s!^PWDIR =.*!PWDIR =/mynis
/etc!g' > Makefile.tmp
mv Makefile.tmp Makefile
echo "removing lines that has root account from passwd and shadow files"
cat /mynis/etc/passwd sed 's!^root!#root!g' > /mynis/etc/passwd
cat /mynis/etc/shadow sed 's!^root!#root!g' > /mynis/etc/shadow
echo "Backing up NSSWITCH file"
cp /etc/nsswitch.conf /etc/nsswitch.backup
cp /etc/nsswitch.files /etc/nsswitch.conf
echo "-------------------------------"
echo "Configuring NIS Master server"
echo "-------------------------------"
/usr/sbin/ypinit -m
echo "NIS configured Successfully............."
echo "Satrting NIS services...."
/usr/lib/netsvc/yp/ypstart
echo "CONGRATULATIONS!!!"
SCRIPT OUTPUT...........
bash-3.00# ./nisconfig
################################
NIS server Configuration script
written by G.Rengarajan
################################
Backing up Make File
#############################################
Making New NIS server
#############################################
Type Your NIS DOMAIN NAME
INDIA
Your NIS Domain name is INDIA
##### Making NIS Alternate Directory#####
Copying files from ETC directory to Alternate Directory
#########################################################
Configuration Files are copied to Alternate Directory
Adding entry to Makefile
***************************
removing lines that has root account from passwd and shadow files
Backing up NSSWITCH file
-------------------------------
Configuring NIS Master server
-------------------------------
In order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a <control D>
or a return on a line by itself.
next host to add: indigo
next host to add:
The current list of yp servers looks like this:
indigo
Is this correct? [y/n: y] y
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] y
The yp domain directory is /var/yp/INDIA
There will be no further questions. The remainder of the procedure should take
5 to 10 minutes.
Building /var/yp/INDIA/ypservers...
Running /var/yp /Makefile...
updated passwd
updated group
updated hosts
updated ipnodes
updated ethers
updated networks
updated rpc
updated services
updated protocols
updated netgroup
updated bootparams
/var/yp/INDIA/mail.aliases: 12 aliases, longest 10 bytes, 138 bytes total
/usr/lib/netsvc/yp/mkalias /var/yp/`domainname`/mail.aliases /var/yp/`domainname
`/mail.byaddr;
updated aliases
updated publickey
updated netid
/usr/sbin/makedbm /mynis/etc/netmasks /var/yp/`domainname`/netmasks.byaddr;
updated netmasks
updated timezone
updated auto.master
updated auto.home
updated ageing
updated auth_attr
updated exec_attr
updated prof_attr
updated user_attr
updated audit_user
indigo has been set up as a yp master server without any errors.
If there are running slave yp servers, run yppush now for any data bases
which have been changed. If there are no running slaves, run ypinit on
those hosts which are to be slave servers.
NIS configured Successfully.............
Satrting NIS services....
starting NIS (YP server) services:ypstart: unable to enable svc:/network/nis/ser
ver:default; in maintenance
ypserv ypbind ypxfrd rpc.yppasswdd rpc.ypupdated done.
CONGRATULATIONS!!!
----------------------------------
Do you have any suggestion please let me know.....
1 comment:
Good man!
try to more script..
Post a Comment