I want to mount a NFS file system with user/group ownership of <admin> . How it can be done ? mkdir /certchown admin.admin /certmount -t nfs 192.168.2.149:/portalweb /cert/
Mounting a NFS file system by changing default owner
linux;permissions;mount;nfs
Create user and group admin with non-interactive shell on NFS server, assuming that admin user and group exists in nfs client. The non-interactive shell option will prevent admin at NFS client from gaining access to NFS server. It works, because nfs maps uid and gid of server with its clients, so any file permissions assigned to the exported directories will remain intact as long the uid and gid matches between the server and client for admin user and group. ACL is an nfsv3 specific option.Note down the admin uid and gid (primary) in client machine and use it to create an account in NFS server. For example uid|gid of admin in client machine = 502NFS Server:As root user:useradd -u 502 -s /sbin/nologin adminmkdir /portalwebchmod 770 /portalwebchown admin /portalwebchgrp admin /portalwebls -ld /portalwebgetfacl /portalwebYou can allow collaboration among admin group members through setgid bit placed on /portalweb directory.vim /etc/exports     /portalweb 192.168.2.149(ro,sync,root_squash):wqexportfs -rvNFS Client:As root user:mkdir /certvim /etc/fstab192.168.2.149:/portalweb /cert nfs ro,nfsvers=4 0 0:wqmount -adf -h -F nfsmount | grep nfs          192.168.1.71:/exports on /cert type nfs (r0,nfsvers=4,addr=192.168.2.49,clientaddr=192.168.2.50)Root user cannot access the files in /cert, because root has been squashed to user and group: nobody (see /etc/exports on NFS server). But root has the privilege to mount the NFS exports on the client machine, by default. If you prefer to use autofs service, normal users like admin do not have privilege to set automounting NFS directories using autofs service, unless they have been given special administrator privileges as like sudo users.ls -ld /cert       drwxrwx---. 12 admin admin 4096 Dec 10 /certls /cert      ls: cannot open directory /cert: Permission deniedsu - adminAs admin user (only admin user (or admin group if properly configured with uids matching between client and server) can access the /cert contents):ls /certAs any other user:ls /cert   ls: cannot open directory /cert: Permission denied