Writing/reading from/to NetApp NFS volume with the same users, but different uid/gid
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Writing/reading from/to NetApp NFS volume with the same users, but different uid/gid
Hello, we have a netapp nfs volume mounted on 2 machines. Both machine use the same user/grouo to write/read from this volume, but when this users are/where created they didn't get the same uid and gid. Now, if one of the server write to the NFS volume, the other server wont be able to read/write for the exact file.
Any idea how to fix it? Also, we don't really have access to the netapp nfs volume, we only get it to use it.
When using NFSv4 , a username/groupname used instead of uid/gid.
You should configure NetApp and clients authenticates against same authority and you will get what you want.
It is a nightmare even in documentation, I never did it.
So, just fix uid/gid on one of servers and forget about v4.
When using NFSv4 , a username/groupname used instead of uid/gid.
You should configure NetApp and clients authenticates against same authority and you will get what you want.
It is a nightmare even in documentation, I never did it.
So, just fix uid/gid on one of servers and forget about v4.
Are you refering to make sure all uids/gids are identical on both servers? If is that what you mean, is not really possible. The machines are already setup with the application and its very difficult to do that at this moment in time.
These commands are dangerous, check them somewhere before run. Please also consider backup.
Also umount any remote system.
Probably using more narrow /home in "find" command will be much better than /.
If you absolutely can't change the UIDs and GIDs, there's a way to deal with this, but it's VERY dirty, and I wouldn't recommend it at all - largely posting for completeness' sake.
Suppose on server1 the app runs as UID U1 and GID G1 and on server2 it runs as UID U2 and GID G2. You will have to do the following -
1. On server1, create a group G1a (the name doesn't really matter) with the same GID as G2 on server2. Likewise, on server2, create a group G2a with the same GID as G1 on server1.
2. Add U1 to the G1a group on server1 and add U2 to the G2a group on server2.
3. Using whatever mechanism is required by your app - set the umask to 007 (or 002 if the files are supposed to be word readable). Generally this means putting the "umask 007" command in U1 and U2's .bashrc files or editing the init scripts of your application to set the umask explicitly.
Restart the application, From server1's perspective, files created on server2 should be owned by U2/G1a, but since U1 is in the G1a group and the files are group readable and writeable (assuming you did the umask trick right and the application didn't change the permissions out from under you), the app on server1 will be able to read and write them. Likewise for server2.
But seriously, why would you ever go into this trouble - it's confusing and fragile. It'd be far, far better to change the UIDs and GIDs to be consistent as suggested.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.