# Ypbind successful, but cannot login with NIS

**URL:** <https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409>\
**Category:** Rocky Linux Help & Support\
**Created:** [July 6, 2021, 6:08am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409 "2021-07-06T06:08:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kevin](https://forums.rockylinux.org/u/Kevin)\
**Post date:** [July 6, 2021, 6:08am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/1 "2021-07-06T06:08:18Z")

</div>

Hi All,

I’m trying to use NIS on Rocky Linux 8.4. I’ve successfully ypbind, but I still cannot login my account with NIS unless I add these two things:

1. Add this line in /etc/passwd  
====  
\<my\_account\>:x:1736:1501:\<my\_account\_name\>:/home/\<my\_account\>:/bin/bash  
====
2. Add this line in /etc/shadow  
====  
\<my\_account\>:\<my\_pwd\>::0:99999:7:::  
====  
\<my\_pwd\> is the encrypted password string getting from yptest | grep \<my\_account\>

Once I have changed my passwd, I will have to modify these two things. It is not convenient.

Has anyone encountered this problem before?

Thanks

---

<div class="post-metadata">

**Author:** ![Lothar](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/lothar/32/963_2.png) [@Lothar](https://forums.rockylinux.org/u/Lothar)\
**Post date:** [July 8, 2021, 1:00am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/2 "2021-07-08T01:00:29Z")

</div>

Have you checked the “passwd”, “group”, and “shadow” entries in the /etc/nsswitch.conf to make sure that ‘nis’ is one of the methods to be used ? (backup the original file before modifying)

The ‘original’ file that ‘I’ see, have ‘these’ entries:

```auto
# Example:
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis

passwd: files sss
shadow: files sss
group: files sss

```

You will probably want each entry to have the following ‘methods’ in ‘this’ order:  
`: files nis sss`

The ‘manual’ method you used, worked since ‘files’ is one of the methods (and the primary method to be used)

OH, and and odd behavior with NIS, may require that the ‘compat’ method be used in the “group” entry and possibly the others (do a ‘man nsswitch.conf’ for more info)

---

<div class="post-metadata">

**Author:** ![Kevin](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kevin](https://forums.rockylinux.org/u/Kevin)\
**Post date:** [July 8, 2021, 2:43am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/3 "2021-07-08T02:43:19Z")

</div>

Hi,

Yes, I did change the “passwd”, “group”, and “shadow” entries to “files nis sss” or “nis files sss”. But neither of them will work. Forgot to mention that I run my Rocky Linux on a vmplayer to test. Not sure if it may be the vmplayer’s problem.

Thanks

---

<div class="post-metadata">

**Author:** ![Lothar](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/lothar/32/963_2.png) [@Lothar](https://forums.rockylinux.org/u/Lothar)\
**Post date:** [July 8, 2021, 6:57pm UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/4 "2021-07-08T18:57:54Z")

</div>

Or, the old ‘port’ issue, being ‘blocked’ by either local host firewall rules, or that of the hosting ‘iron’…

---

<div class="post-metadata">

**Author:** ![Kevin](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kevin](https://forums.rockylinux.org/u/Kevin)\
**Post date:** [September 6, 2021, 4:05am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/5 "2021-09-06T04:05:52Z")

</div>

Hi, I’ve turned off the firewall but still not working. I doubt it’s the passwd encrypting method that cause this issue, maybe our nis server and the rocky linux have different passwd encrypting settings. Do you know where can I find the rocky linux’s passwd encrypting settings?

---

<div class="post-metadata">

**Author:** ![sweh](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sweh/32/1287_2.png) [@sweh](https://forums.rockylinux.org/u/sweh)\
**Post date:** [September 6, 2021, 12:12pm UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/6 "2021-09-06T12:12:06Z")

</div>

If you run the command `ypcat passwd` do you see the NIS password map? If not then you don’t have the NIS layer working. This is a low level test to show that `ypbind` is talking to a NIS master and getting results back.

If you run the command `getent passwd` do you see all the local entries and _then_ the NIS entries? How about `getent passwd a_nis_user` (where you need to pick a user in the NIS map that is _not_ in the local password file). If that doesn’t work then you have your nss layer misconfigured.

If all these work then the problem is likely to be at the PAM stack or elsewhere.

How are you trying to login? On a text console? Via `ssh`? From a GUI login? One normal “gotcha” with GUI logins is if the home directory doesn’t exist or has the wrong owner/permissions.

---

<div class="post-metadata">

**Author:** ![Kevin](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kevin](https://forums.rockylinux.org/u/Kevin)\
**Post date:** [September 7, 2021, 2:16am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/7 "2021-09-07T02:16:55Z")

</div>

Hi @sweh,

1. If you run the command `ypcat passwd` do you see the NIS password map? Yes.
2. If you run the command `getent passwd` do you see all the local entries and _then_ the NIS entries? Yes.
3. I `getent passwd a_nis_user` and I can see the user in the NIS map that is _not_ in the local password file

I’ve tried to login with

1. Via ssh using the terminal on my computer to my Rocky Linux on a virtualbox and
2. Directly using the GUI login on the Rocky Linux on a virtualbox  
but neither of them will work.

I `ypwhich` and it did show my nis server’s IP, and I can successfully ping from my Rocky Linux to this IP.

And my user directory setting under my home directory is the same as the user folder on my other computer which can successfully login with nis.

---

<div class="post-metadata">

**Author:** ![Kevin](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kevin](https://forums.rockylinux.org/u/Kevin)\
**Post date:** [September 7, 2021, 7:09am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/8 "2021-09-07T07:09:18Z")

</div>

Hi, I `authselect select nis` and it worked

---

<div class="post-metadata">

**Author:** ![sweh](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sweh/32/1287_2.png) [@sweh](https://forums.rockylinux.org/u/sweh)\
**Post date:** [September 7, 2021, 12:32pm UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/9 "2021-09-07T12:32:47Z")

</div>

So all the tests (eg ypcat) demonstrated that NIS was working, and a minimal level of `nsswitch` was good.

Now since `authselect` primarily rewrites `nsswitch.conf` and `/etc/pam.d/` files this highlights that’s where the problem was; either with one of the nsswitch entries or with PAM. If you have a copy of before/after then you might be able to see what the important change was.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 4:05am UTC](https://forums.rockylinux.org/t/ypbind-successful-but-cannot-login-with-nis/3409/10 "2023-08-25T04:05:46Z")

</div>


