LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-11-2016, 08:04 PM   #1
george102
LQ Newbie
 
Registered: Jun 2016
Posts: 1

Rep: Reputation: Disabled
Debian 8-NFS-Deny access to specific IP to specific "share" directory


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!

Last edited by george102; 06-11-2016 at 08:22 PM. Reason: It is working now
 
  


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
How To Make NFS Share only accessible to specific hostnames or domains aadams Linux - General 4 08-27-2015 04:54 PM
[SOLVED] How to deny access to specific file using htaccess ? Dareros Linux - Software 4 06-21-2014 11:54 AM
deny a user access to specific command krock923 Linux - Security 7 10-11-2012 03:04 PM
Limiting sshfs access to a specific directory, or tunneling nfs over ssh. Jophish Linux - Networking 5 01-24-2010 04:59 AM
How to deny root access to specific user's files haariseshu Red Hat 8 09-04-2009 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:06 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