LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Permissions error with NFS (https://www.linuxquestions.org/questions/linux-server-73/permissions-error-with-nfs-779445/)

amishtechie 01-02-2010 01:31 PM

Permissions error with NFS
 
I am having a bit of an issue with a NFS configuration. Initially I had no issues when both the server and client were both running Ubuntu Karmic. The client is now running Fedora Core 12 and when I mount the share I get "You do not have the permissions necessary to view the contents of Mnt". I came across this troubleshooting guide and it suggests that the issue may be the UIDs are not in sync on the server and client. If this is the issue, which usernames do I need to sync and how would I do that? Thank you.

jschiwal 01-02-2010 01:50 PM

If you run "ls -ln", you can see your users uid & primary gid numbers quickly.
You can also examine your /etc/passwd file, or run "getent passwd <username>".

If you were running as root (a bad idea) when entering the nfs share, a "rootsquash" option will have changed your uid to nobody, which may not have had permissions to read files.

If you are running an NIS server, then the UID numbers can be different between machines. Another option is using ldap for authentication, which keeps the uid numbers centralized as an NIS server would. For a home user, be aware of the UID number ranges that your distros use and keep them the same.

Also look at the /etc/login.defs file. It is where these ranges are defined.
Code:

#
# Min/max values for automatic uid selection in useradd
#
# SYSTEM_UID_MIN to SYSTEM_UID_MAX inclusive is the range for
# UIDs for dynamically allocated administrative and system accounts.
# UID_MIN to UID_MAX inclusive is the range of UIDs of dynamically
# allocated user accounts.
#
SYSTEM_UID_MIN            100
SYSTEM_UID_MAX            499
UID_MIN                  1000
UID_MAX                60000

#
# Min/max values for automatic gid selection in groupadd
#
# SYSTEM_GID_MIN to SYSTEM_GID_MAX inclusive is the range for
# GIDs for dynamically allocated administrative and system groups.
# GID_MIN to GID_MAX inclusive is the range of GIDs of dynamically
# allocated groups.
#
SYSTEM_GID_MIN            100
SYSTEM_GID_MAX            499
GID_MIN                  1000
GID_MAX                60000

SuSE Linux starts UID numbers (UID_MIN) at 1000 whereas Fedora and Mandriva for example start at 500. When I installed Fedora on my netbook, I changed UID_MIN and GID_MIN to match.

On the new distro, modify your UID & GID entry in /etc/passwd, and use chown to change your files' UID & GID numbers:
sudo find /home/<username> /tmp/ /var/ -user <old_uid> -exec chown <newuid> '{}' \;
sudo find /home/<username> /tmp/ /var/ -group <old_gid> -exec chgrp <new_gid> '{}' \;

You can also use "usermod" to change your UID.

Reboot after making the changes. Linux uses setfacl on devices to grant you access. It would be best to reboot to clean things up. You could delete the files in /tmp just before rebooting to clean it out instead of changing the UID & GID of user files in it.

amishtechie 01-02-2010 04:20 PM

Thanks. Everything is up and running correctly.


All times are GMT -5. The time now is 08:31 PM.