3

I'm serving /exports/home (home directories) and /exports/pkgsrc (NetBSD's pkgsrc repository) from an OpenBSD NFSv3 server running OpenBSD 6.0-release to an internal network of OpenBSD and Ubuntu 16.10 hosts, and one Solaris 11.3 host.

This works well for the home directories on Ubuntu and OpenBSD, because the UIDs and GIDs of the users happens to be the same on both system.

On Solaris, I had to manually change the UIDs since Solaris starts allocating UIDs at 100 rather than at 1000. I think it is manageable to do this manually for users that I've added, but not really for other default system UIDs/GIDs.

For the pkgsrc export, I'd like the mount to show up as root:src on Ubuntu and root:wsrc on OpenBSD, but the src group is GID 40 on Ubuntu while the wsrc group has GID 9 on OpenBSD (9 is news on Ubuntu). On Solaris, GID 9 belongs to the nuucp group.

Is it possible to perform a remapping of (at least) the GID between the client and server when mounting an NFSv3 share? I don't really want to have to manually synchronize UIDs and GIDs that I didn't add myself across heterogeneous Unix systems... Is there an easier way to do this (keeping in mind that I can't just use NFSv4 on OpenBSD)?

The workaround will be to add a completely new pkgsrc group with a GID that is unique on all systems, but I'll wait with that to see if there's a better solution.

This is /etc/exports on the omni server:

/exports/home   -network=10.0.0 -mask=255.255.255.0
/exports/pkgsrc -network=10.0.0 -mask=255.255.255.0

This is the corresponding fstab entries on an Ubuntu host:

omni:/exports/home   /home       nfs rsize=4096,wsize=4096,soft
omni:/exports/pkgsrc /opt/pkgsrc nfs rsize=4096,wsize=4096,soft

The pkgsrc directory, on the OpenBSD server:

$ ls -ld /exports/pkgsrc
drwxrwxr-x  52 root  wsrc  2048 Feb 18 20:07 /exports/pkgsrc

and on an Ubuntu host:

$ ls -ld /opt/pkgsrc
drwxrwxr-x 52 root news 2048 Feb 18 20:07 /opt/pkgsrc

... and I'd like news (GID 9) to be src (GID 40).

  • In Linux, you can (re)define in /etc/login.defs UID_MIN and UID_MAX. Why not going for LDAP authentication for the users? – Rui F Ribeiro Feb 18 '17 at 21:50
  • 1
    @RuiFRibeiro I think I might have to head down that route, which is something I've never done before, which is why I wanted to make sure there was no alternative. – Kusalananda Feb 18 '17 at 21:56
  • I had inherited systems that used scripts to automate user creation across different OSes, and dealing with small errors or inconsistencies was a nightmare. – Rui F Ribeiro Feb 18 '17 at 22:14
  • 2
    Using LDAP or any other centralized user management will not help in your situation, as system users and groups have to be as defined in /etc/passwd; otherwise some OS like Solaris or BSD won't work any more. For this special requirement, your suggested workaround with an additional group pkgsrcon all the systems will be the best solution. – ridgy Feb 19 '17 at 14:01

Your Answer

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

Browse other questions tagged or ask your own question.