Hello everyone, I'm new on this and I'm trying to setup a NFS share with some specifications.
I have 1 server and 3 clients.
I need that the 3 clients can access a share1 as read-only, and,
2 of the clients can access another share2 as read-write and restrict the access to the third client to share2
to be exact:
Client1,Client2,Client3 ----> read only access to Server:/nfs/public1
Client1,Client2 ------------> read/write access to Server:/nfs/public2
This is my exports file
/nfs/public1 192.168.0.101(ro,sync,no_root_squash) 192.168.0.102(ro,sync,no_root_squash) 192.168.0.103(ro,sync,no_root_squash)
/nfs/public2 192.168.0.101(rw,sync,no_root_squash) 192.168.0.102(rw,sync,no_root_squash)
/nfs/public1 and /nfs/public2 are owned by root but they have 777 permissions.
I can mount /nfs/public1 on Client1, Client2 and Client3 with the appropiate ro restrictions according to exports file.
And I can mount /nfs/public2 on Client1 and Client2 as well as rw,
My issue is that Client3 can also mount /nfs/public2.
I need to restrict Client3, unable it to mount /nfs/public2
I've checked man exports and I don't see anything there to accomplish this. Is there a way to deny NFS mount to Client3 only to /nfs/public2?
I've checked the use of hosts.allow/hosts.deny but I don't see this as a solution because I do need that Client3 can mount /nfs/public1,
Just need to deny the mount of /nfs/public2 to Client3.
Thanks in advance for any help! (and sorry for any typo, english is not my main language)
#### EDIT #####
Just after I've posted this question and did something that I didn't tried before,
I've deleted everything, and then write everything again on /etc/exports... and now is working
for those that had my problem, this is my exports:
/var/nfs/public1 192.168.0.103(ro,sync,no_root_squash) 192.168.0.100(ro,sync,no_root_squash)
/var/nfs/public2 192.168.0.103(rw,sync,no_root_squash)
Whit this 192.168.0.100 does not have mount permissions on /var/nfs/public2
This is the output I have when I tried (192.168.0.14 is the server)
# mount -t nfs 192.168.0.14:/var/nfs/public2 /mnt/nfs2
mount.nfs: access denied by server while mounting 192.168.0.14:/var/nfs/public2
This is what I wanted.
I've rewritten exports file, then I ran
#exportfs -ra
and just in case I've restarted the service
#/etc/init.d/nfs-kernel-server restart
and then the magic happened, it is working now
Thank you all, I've read half of the posts with NFS in the subject to finish this
Best regards!