I am trying to share the home directory of a NIS user using NFS and autofs. During testing, I get the following error message:

Could not chdir to home directory /home/guest/nis1: Permission denied
-bash: /home/guest/nis1/.bash_profile: Permission denied

How can I troubleshoot the above error?

  • The first thing to look at is ls -l /home/guest/nis1. Are you sure that the NFS server, the NIS server and the client all have the same user ID for nis1? – Gilles 'SO- stop being evil' Dec 5 '10 at 18:22
  • Hi Gilles , How can I check this ??? Jack – user2914 Dec 6 '10 at 12:13
  • @user2914: See loopforever's answer. Are the NFS server and the NIS server the same machine? If you have shell access to it, what does getent passwd nis1 show there? Does it work if you mount the home directory manually? – Gilles 'SO- stop being evil' Dec 6 '10 at 19:15

Use getent passwd nis1 (where nis1 is the user in your example) to get the passwd entry the NFS client is seeing for 'nis1'. getent respects nsswitch.conf, which supplies ordering for nameservice lookups across multiple services (files, nis, ldap, etc...).

After you determine the UID in that response, compare it to the UID who owns the home directory, /home/guest/nis1 by running: stat /home/guest/nis1.

Your problem may be that the permissions on the home directory are restrictive such that there is no execute bit for other (o+x) and the UID that owns the directory is not actually the UID that the NFS client can resolve for that username.

It would be helpful if you provided the output of these commands, even if this answer is not correct so that we can continue to troubleshoot.

  • #stat /home/guest/nis1 Access: (0777/drwxrwxrwx) Uid: ( 503/ nis1) Gid: ( 504/ nis1) Access: 2010-12-06 16:35:37.000000000 +0545 Modify: 2010-12-04 14:50:00.000000000 +0545 Change: 2010-12-04 15:50:27.000000000 +0545 – user2914 Dec 7 '10 at 11:56
  • [root@station2 pest]# getent passwd nis1 nis1:$1$fUdoS4mo$gUwfCjH5jJT5cc9prleKv.:503:504::/home/guest/nis1:/bin/bash – user2914 Dec 7 '10 at 11:57
  • # mount -t nfs NFS_and_NIS_server:/home/guest/nis1 /home/guest/nis1 --even after this, I got the same error.... – user2914 Dec 7 '10 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.