# How to NIS Server in RHEL 4 AS



## praka123 (Sep 20, 2005)

Very Happy Hello to All,
I am preparing for RHCE Exam.I have got a couple of problems while configuring NIS Server
in RHEL 4 AS .I followed the below listed steps to configure and the main problem is in NIS Client machines users home directory is not mounted showing mounting user in '/' .
rpms
ypserv
ypbind
yp-tools
I edited vi /etc/sysconfig/network and added NISDOMAIN="www.pjk.com"
#vi /etc/yp.conf
ypserver 127.0.0.1
Started the following daemons: portmap, yppasswdd, and ypserv.
created nis database:
cd /usr/lib/yp/
[root@www yp]#./ypinit -m
services ypbind and ypxfrd started
service ypbind restart
service ypxfrd restart
created a user #useradd nisuser
#passwd nisuser
---
cd /var/yp
#make
done.
now in client machine i run authconfig and selected nis,given domainname=www.pjk.com
server ip=192.168.1.2
restarted ypbind
now,in client i tried to login as user 'nisuser'
and getting error 'not found /home/nisuser',while /home/nisuser is present in nis server.and i
can login in server as 'nisuser'!.I already tried to change permissions ,using /rhome/nisuser
as default homedir for nisuser etc and not working.But I had successfully configured nis server in RHEL 3 using above steps.Is this to do something with selinux>?Please geeks out there help me Idea Very Happy


----------



## GNUrag (Sep 21, 2005)

For NIS to work properly, you also need to NFS mount users home directories from server. Basically all the homes will be located on a central server and mounted to clients via NFS. like this:
* /etc/exports *

```
/home      192.168.0.0/255.255.255.0(rw)
```
This will enable all the computer in your LAN (192.168.0.0/24) to be able to mount homes directory in read-write mode.

And in the /etc/fstab file of all the clients add the mount option.
* /etc/fstab *

```
192.168.0.100:/home /home  nfs  rw,user 0 0
```
Assuming 192.168.0.100 is your NIS logon server.

Reading NFS howto from TLDP will solve this problem.


----------



## praka123 (Sep 21, 2005)

Thanks for Reply anurag  
*ALAS!SOLVED!Many thanks for insights of Vimal
i tried nfs in server exporting /home dir
#

code:

vi /etc/exports
/home *(rw,sync,no_root_squash)


service nfs restart
In client machine run authconfig
then configure autofs

code:

vi /etc/auto.master
/home /etc/auto.home --timeout=60
vi /etc/auto.home
* --fstype=nfs4 192.168.1.2:/home/&


service autofs restart
tried login as user nisuser in client and...
$pwd
/home/nisuser
------------------------------
If i configure client ip with dhcp,the /etc/yp.conf file gets modified everytime starting client system.what2dowhat2dowhat2dowhat2dowhat2do Please................help
That also solved by editing /etc/dhcpd.conf and adding correct
option-nis-domain value and restarted services; )

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;

option nis-domain "www.pjk.com";
option domain-name "www.pjk.com";
option domain-name-servers 192.168.1.2;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.1.2 192.168.1.4;
default-lease-time 21600;
max-lease-time 43200;*


----------



## praka123 (Sep 21, 2005)

adding entries in /etc/fstab is worth.but i thought automount should
be also be tried as it will mount the automounted directres only 
when we need them.


----------



## GNUrag (Sep 22, 2005)

Automounter daemon is a better idea prakash, as exposing users home directories via NFS is a grave security risk. But then this method is useful if you plan to take an routine/incremental backup of users home directories on another computer.


----------

