LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2009, 04:50 AM   #1
madhanblore
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Rep: Reputation: 0
NFS sharing problem


hi all,

I am trying to share a folder named "test_share" from server1 to server2 using an nfs share(os-centos 5.2), I am successful in configuring nfs share and able to access but the file has been reflecting with different owner (user name and group).

problem is I have a user "test" in both server1 and server2, with UID=500 and GID=500 in server1 and for "test" user in server2 with UID=501 and GID=501, due to this the files which are written by server1 and server2 are appearing as different onwers and can't edit the each other files as files belongs to different users.
but I wanted the shared directory to have permissions for both users in server1 and server2.

to make it clear:
say file named "data_from_server1.txt" is created by test user from server1 in test_share folder.
and file named "data_from_server2.txt" is created by test user from server2 in nfs shared folder test_share.

from server1 if I do ls -l following is the result:
-rw-rw-r-- 1 test test 15 2009-08-01 15:02 data_from_server1.txt
-rw-rw-r-- 1 sapdb sapsys 11 2009-08-01 15:03 data_from_server2.txt

from server2 if I do ls -l following is the result:
-rw-rw-r-- 1 500 500 15 2009-08-01 15:02 data_from_server1.txt
-rw-rw-r-- 1 test test 11 2009-08-01 15:03 data_from_server2.txt

This is because sapdb is installed in server1 consisting of UID=501 and GID=501, so in server1 the owner is reflecting as sapdb sapsys and in server2 there are no user with UID and GID 500 so it reflecting as 500 500 as owner,

due to this problem the files created by server1 can't edited by the test user of server2 and vice versa.

can anybody Please help in resolving the issue.

Last edited by madhanblore; 08-01-2009 at 04:56 AM.
 
Old 08-01-2009, 10:34 PM   #2
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 221Reputation: 221Reputation: 221
If your entry in /etc/exports on server1 looked like this:
Code:
test_share       server2(rw,all_squash,anonuid=500,anongid=500)
The result from that would be that all access from server2 to server1 for that file system would be treated as if the test user were making them. Whatever UID were making the request would be squashed and replaced with UID 500.

This may not be exactly the result that you want, especially if you have lots of users on server2 which you don't want accessing the files in test_share, but it's as close as I know how to get.
 
Old 08-02-2009, 04:57 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Look at nfs v4 and rpc.idmapd. It may be less work to change the UID's of the users so they are the same on all Linux systems. E.G. editing /etc/passwd and recursively chmod'ing their home directories & it's contents.
 
Old 08-02-2009, 02:13 PM   #4
madhanblore
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
Look at nfs v4 and rpc.idmapd. It may be less work to change the UID's of the users so they are the same on all Linux systems. E.G. editing /etc/passwd and recursively chmod'ing their home directories & it's contents.
Can you please provide me a link or any tutorial where they have explained UID GID mapping using nfs v4 and rpc.idmapd
 
Old 08-03-2009, 12:16 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Most of the work would probably be in re-configuring for nfs4 and the authentication model.
http://www.novell.com/coolsolutions/feature/17581.html
http://nfsv4.bullopensource.org/doc/..._migration.pdf

rpc.idmapd is probably already configured in your /etc/idmapd.conf file. It has the mapping for the Nobody-User, Nobody-Group and your domain. As I understand it, ntfs4 uses the user name and it's acls over the wire. The /etc/rpc.idmapd allows you to map user X on the client to user Y on the server. I.E. If you are madhan on the server and madblore on the client.

This link explains that idmapd maps usernames to gid/uid, but after an nfs share is mounted. I hadn't realized that you couldn't use the sec=sys security model in your problem. If I had read this link earlier, I wouldn't have suggested nfs4/idmapd as a solution.
If you use sec=sys, and the uid's differ between the client and the server, then mounting will fail. To be able to have different uid/gid's you need to use one of the kerberos security models. That provides the authentication necessary so that the server knows that a user on the client is the same as the user on the server.
http://opensolaris.org/jive/thread.jspa?threadID=68381

Continuing to use NFS v3 and fixing the username/uid-gid mismatch would be a lot easier. It you were to use NIS or LDAP you would need to do that anyway. Look in the Network Administrators Guide (1st edition) in the NIS chapter. (www.tldp.org). It shows how to use the find command to locate files with one uid and change them. They need to match if you are going to start using a centralized Linux authentication system. The uid's can differ in NFS v4 because the uid/gid's aren't used over the wire at all. Even if you rely on /etc/passwd, IMHO it would be advisable to keep them in sync. Keep track of the next available uid and gid and use that when creating a new user, even if that means skipping a number on a different host.

I didn't mean to advise against migrating to NFS v4. It has security and integration advantages. After reading the third link, I realized that it entails system wide changes.
 
Old 08-07-2009, 01:23 PM   #6
madhanblore
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Hi all,

Thanks you for all your suggestions, I felt nfs v4 is bit tough so I used one of the above given suggestion to solved this issue by using nfs v3 where I have exported as follows

test_share server2(rw,all_squash,anonuid=65534,anongid=65534)

65534 is nfsnobody as both server having the same UID and GID so I mounted this exported folder in both servers so that applications from both server will write as nfsnobody and have permissions to edit or modify.
changed test_share folder permission to 0777.

I would have manually edited the passwd file for changing the UID and GID and use chown commmand, but i was not sure as many applications where installed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing a NFS share off of another NFS server keysorsoze Linux - Networking 2 09-19-2008 10:50 AM
NFS sharing problem in solaris9 sunram Solaris / OpenSolaris 4 03-17-2008 12:48 AM
problem sharing folder via NFS cdavidson Linux - Newbie 4 04-03-2005 08:39 PM
Problem with sharing CD-ROM over network, NFS PR0T0N Linux - Networking 3 12-05-2003 10:18 AM
NFS no sharing hotrodowner Linux - Networking 3 06-06-2002 09:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration