Saturday, February 12, 2011

NIS Interview questions

How to create a nis master

#Echo > /etc/defaultdomain
#Vi /etc/hosts
Sun2 add all the host connected to the network

#Cp /etc/nsswitch.nis /etc/nsswitch.conf
#Vi /etc/nsswitch.conf
File nis – add this entry

#Cd /var/yp
#Ypinit –m – master server
Enter host
Stop at errors say no here

#Cd /var/yp

Here you can see all the deamon get restarted .

Q)which command display the default nis server

Q)which command will display all the master and slave servers
A)Ypcat –k ypservers

Q)how to see the nis users
A)Ypcat passwd

Q)what are the deamons for nis master
A)Ypserv ypbind ypxfrd rpc.ypassword rpc.ypupdates.

Q)what is map
A)Map is table which consist of a key and a file which consist of the information of the key

Q)how to create nis slave server(

#Vi /etc/host
Sun1 master server ip

#Cp /etc/nsswitch.nis /etc/switch.conf
#Vi nsswitch.con
Files nis

#Echo> /etc/defaultdomain or to maintain more security /var/yp/ypservers

#Cd /var/yp
#Ypinit –s sun1 (master server)
Yes give master server ip or hostname
Error say no

#Cd /var/up if u r in that directory then its okay
Ypserv ypbind

#Ypwhich – will display master and slave servers
#Ypcat –k ypservers – list master and slave server

Q)what are the daemon for nis slave server
A)Ypserv ypbind

Q)how to see nis user from the slave
A)Ypcat passwd

38)how to configure nis client

#Vi /etc/hosts
Sun1 - master
Sun2 – slave

#Cp /etc/nsswitch.nis /etc/nsswitch.conf
#Echo > /etc/defaultdomain or /var/yp/ypservers

#Cd /var/yp
#Ypinit –c
Add the slave if available or master
No at errors

#Cd /var/yp

Daemons for nis clients are ypbind

Q)To see nis server and master from the client
A)Ypcat –k ypservers

Q)how do you update slave servers from the master
A)Cd /var/yp
#/usr/ccs/bin/make passswd
Or yppush.

Q)how to create nis+ server and client
#Cp /etc/passwd /export/home/nisfiles
#Cp /etc/group /export/home/nisfiles
#Cp /etc/hosts /export/home/nisfiles

#Vi auto_master
Remove all entries and keep only user name home directories

#cp /etc/nsswitch.nis /etc/nsswitch.conf
Files nisplus


#nisserver –r –Y
#cd /export/home
#nspopulate -v –F

Q)how to create nis+ client

#cp /etc/nsswitch.nis /etc/nsswitch.conf
Files nisplus


#nisclient –I –h –d

Listing table & objects in NIS+
• #nisls ;Gives the total objects in NIS+
• #nisls org_dir ;Lists the tables listed in the directory.
Listing a contents of tables
• #niscat passwd.org_dir
Listing table structure
• #niscat -o passwd.org_dir ;lists structure of password table.
Adding A user
• #nistbladm -a name=john uid=123 gid=111 home=/home/john shell=/bin/sh passwd.org_dir
Changing the user information in passwd table (Super user only
Fill in the corresponding values in <>
• #nistbladm –a name=<> passwd=<> uid=<> gid=<> home=<> shelll=<> passwd.org_d
• #nistbladm -a name=john uid=123 gid=234 home=/home/john shell=/bin/sh passwd.org_di
to change only shell
• #nistbladm -m shell=/usr/local/bin/bash [name=john],passwd.org_dir
Changing user passwd

As root
• # nispasswd ;user has to update his key through

chkey -p
As user
• $ nispasswd ;update encrypted key
• $chkey -p ;(user NIS+ passwd and login passwd are the same.)

Adding user credentials
• #nisaddcred -p 123 -P john local
• # nisaddcred -p -P des
123 is userid and john is the user name.
Adding / removing a user dir entry in auto_home table :
• #nistbladm -a key=john value= auto_home.org_dir
• #nistbladm -r key=john auto_home.org_dir ;If key is not unique then more fields needs to be defined .
Removing a user
• #nistbladm -r name=john passwd.org_dir
Modifying the tables for multiple entries.
• #nisaddent -d passwd > /tmp/passwd ;Dump the table to a file
• #vi /tmp/passwd ;Edit the dumped file
• # nisaddent -r -f /etc/passwd passwd ;Put back the dumped file.
nisaddent command is available only for some of the standard tables, for others either nispopulate or nistbladm has to be used .

No comments:

Post a Comment