LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   AUTOFS not working in NIS (https://www.linuxquestions.org/questions/linux-server-73/autofs-not-working-in-nis-862221/)

vikas027 02-12-2011 07:07 AM

AUTOFS not working in NIS
 
Hi All,

I have all CENTOS 5.5 boxes.

This is my scenario.
Code:

192.168.1.10    box1.test.com    NIS and NFS SERVER
192.168.1.20    box1.test.com    NIS CLIENT / NFS CLIENT (AUTOFS)

These are NFS exports on box1 which I am trying to Automount on box2
Code:

[root@box2 ~]# showmount -e 192.168.1.10
Export list for 192.168.1.10:
/home            *
/nishome/network1 *

I have certain users' home dir. on /home and some users' home dir of network1 in /nishome/network1

Home dirs. under /home are automounting perfectly BUT
home dirs. under /nishome/network1 are not automounting.

Code:

[root@box2 ~]# hostname
box2.example.com

[root@box2 ~]# nisdomainname
ABCD

[root@box2 ~]# getent passwd | tail -4
vicky:$1$132.5HcH$sq6UJxNpFrcUh8l1FAHlV0:502:502::/home/vicky:/bin/bash
vikas:$1$2j6jtgf5$eliQcjFhCbqi.hdZCqaEY/:501:501::/home/vikas:/bin/bash
nisuser1:$1$jejlU3CC$GYEhZl8LHGdAUqn7FXaPu0:800:800::/nishome/network1/nisuser1:/bin/bash
nisuser2:$1$hBQOEA.S$Z3.glka5imAtE6vyJxMBM1:801:801::/nishome/network1/nisuser2:/bin/bash

These are my autofs config files:
Code:

[root@box2 ~]# grep home /etc/auto.master
/home  /etc/auto.home
/nishome /etc/auto.nishome

[root@box2 ~]#  cat /etc/auto.home
*      -fstype=nfs 192.168.1.10:/home/&

[root@box2 ~]#  cat /etc/auto.nishome
*      -fstype=nfs 192.168.1.10:/nishome/network1/&

Now, this is my problem.

Quote:

[root@box2 ~]# su - vikas
[vikas@box2 ~]$ pwd
/home/vikas
[vikas@box2 ~]$ exit
logout
[root@box2 ~]# su - vicky
[vicky@box2 ~]$ exit
logout
[root@box2 ~]# su - nisuser1
su: warning: cannot change directory to /nishome/network1/nisuser1: No such file or directory
-bash-3.2$ exit
logout
[root@box2 ~]# su - nisuser2
su: warning: cannot change directory to /nishome/network1/nisuser2: No such file or directory
-bash-3.2$ exit
logout
Manual mounting goes fine.
Code:

[root@box2 ~]# mount -t nfs 192.168.1.10:/nishome/network1 /nishome

[root@box2 ~]# df -hP /nishome
Filesystem            Size  Used Avail Use% Mounted on
192.168.1.10:/nishome/network1  4.8G  3.7G  857M  82% /nishome


Any help, how to dig it further. I worked fairly on NIS, but never used any other dir. other than /home for automounting.

Apologies, if this post became a little longer. Actually, I have tried to give the maximum information.

fortez 02-12-2011 06:20 PM

Hi vikas027
assuming oyur nis configuration is correct, can you change passwd entries in box2
Code:

nisuser1:$1$jejlU3CC$GYEhZl8LHGdAUqn7FXaPu0:800:800::/nishome/network1/nisuser1:/bin/bash
nisuser2:$1$hBQOEA.S$Z3.glka5imAtE6vyJxMBM1:801:801::/nishome/network1/nisuser2:/bin/bash

in

Code:

nisuser1:$1$jejlU3CC$GYEhZl8LHGdAUqn7FXaPu0:800:800::/nishome/nisuser1:/bin/bash
nisuser2:$1$hBQOEA.S$Z3.glka5imAtE6vyJxMBM1:801:801::/nishome/nisuser2:/bin/bash


vikas027 02-13-2011 07:34 AM

Hi Fortez,

Yes, I can change passwords sitting on NIS cients.

Code:

[root@box2 ~]# su - nisuser1
su: warning: cannot change directory to /nishome/network1/nisuser1: No such file or directory
-bash-3.2$
-bash-3.2$ passwd
Changing password for user nisuser1.
Changing password for nisuser1
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
-bash-3.2$


fortez 02-13-2011 08:31 AM

Hi vikas027
in a nis architecture password is changed with yppasswd...
However i mean not to change pasword, but to change home directory from /nishome/network1/nisuser1(2) to /nishome/nisuser1(2)

vikas027 02-13-2011 08:35 AM

Quote:

Originally Posted by fortez (Post 4256875)
Hi vikas027
in a nis architecture password is changed with yppasswd...
However i mean not to change pasword, but to change home directory from /nishome/network1/nisuser1(2) to /nishome/nisuser1(2)

This is what I do not want to do. Actually, in RHCE exam there used to be a question (around 2 years ago) to configure autofs such that /nishome/station1/nisuser1 home directory which is on NIS server gets mounted to local system at /nishome/nisuser1 (not /nishome/station1/nisuser1)

I was able to it there, but could not configure their NIS setup at my place.

fortez 02-13-2011 09:19 AM

I think you are confusing nis configuration and nfs configuration
I do not understand your RHCE reference, but i think that your nfs configuration is wrong independently from nis use and RHCE exam experience
If you read your nfs maps

Quote:

[root@box2 ~]# grep home /etc/auto.master
/home /etc/auto.home
/nishome /etc/auto.nishome

[root@box2 ~]# cat /etc/auto.home
* -fstype=nfs 192.168.1.10:/home/&

[root@box2 ~]# cat /etc/auto.nishome
* -fstype=nfs 192.168.1.10:/nishome/network1/&
you see that :
- when on client you type cd /home/vikas , you are mounting /home/vikas directoty that is on nfs server
- when on client you type cd /nishome/network1/nisuser1 , you are mounting /nishome/network1/network1/nisuser1 directoty on nfs server; this directory with double network1 do not exist on nfs server

vikas027 02-13-2011 09:43 AM

See I want this, which works well with NFS

Code:

[root@box2 ~]# mount -t nfs 192.168.1.10:/nishome/network1 /nishome

[root@box2 ~]# df -hP /nishome
Filesystem            Size  Used Avail Use% Mounted on
192.168.1.10:/nishome/network1  4.8G  3.7G  857M  82% /nishome


fortez 02-13-2011 09:54 AM

Afer this manual mount, can you make

Quote:

[root@box2 ~]# su - nisuser1
withou error?

vikas027 02-13-2011 11:24 AM

No.


Code:

[root@box2 ~]# mount -t nfs 192.168.1.10:/nishome/network1 /nishome
[root@box2 ~]# df -HTP
Filesystem    Type    Size  Used  Avail Use% Mounted on
/dev/sda2    ext3    5.1G  3.2G  1.8G  65% /
/dev/sda1    ext3    104M    12M    87M  13% /boot
tmpfs        tmpfs    131M      0  131M  0% /dev/shm
192.168.1.10:/nishome/network1 nfs  5.1G  4.0G  906M  82% /nishome
[root@box2 ~]#
[root@box2 ~]#
[root@box2 ~]# cd /nishome/
[root@box2 nishome]# ls -l
total 8
drwx------ 3 nisuser1 nisuser1 4096 Feb 13 22:52 nisuser1
drwx------ 3 nisuser2 nisuser2 4096 Feb 12 18:01 nisuser2
[root@box2 nishome]#
[root@box2 nishome]# cd
[root@box2 ~]#
[root@box2 ~]# su - nisuser1
su: warning: cannot change directory to /nishome/network1/nisuser1: No such file or directory
-bash-3.2$


fortez 02-13-2011 12:37 PM

It confirms that you have to change home directory in /etc/passwd file as i have suggested before....

So:
1) if you want that /nishome/nisuser1/ on client matchs /nishome/network1/nisuser1 on nfs server your autofs maps are correct and you have to change your /etc/passwd file in

Quote:

nisuser1:$1$jejlU3CC$GYEhZl8LHGdAUqn7FXaPu0:800:800::/nishome/nisuser1:/bin/bash
nisuser2:$1$hBQOEA.S$Z3.glka5imAtE6vyJxMBM1:801:801::/nishome/nisuser2:/bin/bash
in way that when you type cd /nishome/nisuser1/ on your client, you are using /nishome/network1/nisuser1 on nfs server,

2) if you want that /nishome/network1/nisuser1 on client matchs exactly /nishome/network1/nisuser1 on nfs server your /etc/passwd file is correct but you have to create network1 directory under nishome on client and to change your auto.master map in
Quote:

/home /etc/auto.home
/nishome/network1/ /etc/auto.nishome
Because you have a nis architecure, changes in /etc/passwd or /etc/auto.master have to made on nis server. From these files o nis server then you rebuild corresponding nis maps.

vikas027 02-14-2011 02:41 PM

Hi Fortez,

I do agree about your points, but I am still confused how RHCE server builders did this.

fortez 02-14-2011 03:17 PM

Assuming you have clear nfs configuration as it was without nis, please can you post:

- nsswitch.conf on nis/nfs client
- auto.master,auto.home,auto.nishome on nis/nfs server
- the output of ls -l /var/yp/your_nis_domain on nis/nfs server

tiagofga 09-10-2012 02:04 PM

Quote:

Originally Posted by fortez (Post 4258235)
Assuming you have clear nfs configuration as it was without nis, please can you post:

- nsswitch.conf on nis/nfs client
- auto.master,auto.home,auto.nishome on nis/nfs server
- the output of ls -l /var/yp/your_nis_domain on nis/nfs server

Hi Fortez,

I has same problem cited above.

My nsswitch.conf is:

Code:

#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
#        nisplus                        Use NIS+ (NIS version 3)
#        nis                        Use NIS (NIS version 2), also called YP
#        dns                        Use DNS (Domain Name Service)
#        files                        Use the local files
#        db                        Use the local database (.db) files
#        compat                        Use NIS on compat mode
#        hesiod                        Use Hesiod for user lookups
#        [NOTFOUND=return]        Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:    db files nisplus nis

passwd:    files nis
shadow:    files nis
group:      files nis
initgroups: files

#hosts:    db files nisplus nis dns
hosts:      files nis dns myhostname

# Example - obey only what nisplus tells us...
#services:  nisplus [NOTFOUND=return] files
#networks:  nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:    nisplus [NOTFOUND=return] files
#netmasks:  nisplus [NOTFOUND=return] files   

bootparams: nisplus [NOTFOUND=return] files

ethers:    files
netmasks:  files
networks:  files
protocols:  files
rpc:        files
services:  files

netgroup:  nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus

My auto.home:

Code:

* -fstype=nfs, rw, nolock 10.50.2.154:/export/home/&
My auto.master:

Code:

/home  /etc/auto.home


All times are GMT -5. The time now is 01:44 AM.