Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

NFS Share


  • Please log in to reply
15 replies to this topic

#1 DefaultGateway

DefaultGateway

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 04 February 2016 - 05:41 AM

I want to share a Folder using NFS. In "/etc/exports", I added the rule "[Full Path of Folder I want to Share] [IP Address of Network]/[CIDR](rw,sync)".

Other options like "nohide" and "insecure" didn't made the Folder to be Shared.

So (rw,sync,nohide,insecure) didn't work.

 

If I restart NFS and the service "portmap", Folder is still not shared.

If I do the command "exportfs -rav", there is no error, but the Folder is still not shared.



BC AdBot (Login to Remove)

 


#2 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 04 February 2016 - 06:42 AM

I assume you're doing the exportfs as root or sudo'd?

Can you show us the contents of /etc/exports and the output of "sudo exportfs -v"?  If the IP addresses are public (hope not), simply change them to A.B.C.D.

 

What distribution/version are you using? 

Have you tried mounting the directory on another machine after going through the export steps? 

There may be other services that need to be started (hence the question about what distribution) besides nfs server and portmap.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#3 DefaultGateway

DefaultGateway
  • Topic Starter

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 04 February 2016 - 08:17 AM

My "/etc/exports" is [Full Path of Folder I want to Share] [IP Address of Network]/[CIDR](rw,sync) .

The other rules in that file is by Default and is commented out with #.

 

I am using Ubuntu 12.04.4 and the command "exportfs -rav" I am doing with Sudo.

Because the Folder is not visible on the Local Network, mounting should result in an error and it is.

The error is "mount.nfs: remote share not in 'host:dir' format".

My mount rule in "/etc/fstab" is "//[IP Address of NFS Server]/[Name of Shared Folder] [Mount Point] [Network File System] [Username=()],[password=()] 0 0".



#4 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 04 February 2016 - 08:51 AM

Thank you, and yes I understood what you had in your first post, but asking for the exact contents of files helps eliminate any transcription errors.

 

For example, your last line says this:

My mount rule in "/etc/fstab" is "//[IP Address of NFS Server]/[Name of Shared Folder] [Mount Point] [Network File System] [Username=()],[password=()] 0 0".

 

The line above it says this:

The error is "mount.nfs: remote share not in 'host:dir' format".

 

The two of them together indicate a problem to me, that I don't know if it is transcription or not.  /etc/fstab line should read something like this:

192.168.128.1:exportedDirectory /localmountpoint nfs mountoptions 0 0

 

You tell me your /etc/fstab line is

//[IP Address of NFS Server]/[Name of Shared Folder] [Mount Point] ....

 

See the difference?  You start off with //.  The error message clearly indicates it should be ipaddr:exportname

 

Which goes back to WHY I asked for cut and paste of contents.  Is this a transcription error or not?  If not, hopefully I've given you enough information to fix your problem, if so, hopefully I've given you enough information to fix your problem.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#5 DefaultGateway

DefaultGateway
  • Topic Starter

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 04 February 2016 - 12:04 PM

Thank you for your reply. :)

That mount rule beginning with // is 100% correct, // means that the Folder you want to mount is on a different device and/or network.

 

I'm just wondering what I'm missing. Because the "/etc/exports" File is correct, and the command "sudo exportfs -rav" didn't give any errors.

NFS and portmap restarted, but if I go to  (From Windows OS => \\[IP Address of Server]), I don't see the Folder (that is also in the "/etc/exports" File) being shared.


Edited by DefaultGateway, 04 February 2016 - 12:06 PM.


#6 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 04 February 2016 - 12:36 PM

Thank you for your reply. :)

That mount rule beginning with // is 100% correct, // means that the Folder you want to mount is on a different device and/or network.

 

I'm just wondering what I'm missing. Because the "/etc/exports" File is correct, and the command "sudo exportfs -rav" didn't give any errors.

NFS and portmap restarted, but if I go to  (From Windows OS => \\[IP Address of Server]), I don't see the Folder (that is also in the "/etc/exports" File) being shared.

About the // where are you getting that from?  I have never seen that for a filesystem that is NFS.  It may be valid for SMB/CIFS or another format, but NFS, I can't find any references.  Look at the error message coming out from mount.nfs:  to me that clearly states the format is wrong.  Did you try to modify /etc/fstab on the client machine to make it more like the lines I showed?  On the machine that is serving the NFS directory, did you do "showmount -e"?  If so, what does it show?

 

Are you really trying to export via NFS or are you trying to do a SAMBA share?  From a Linux/Unix client machine, what does showmount -e IPADDRESSOFSERVER show?

 

You know, I maintain it would be much easier if we saw the actual contents of /etc/fstab on the NFS client machine and the actual contents of /etc/exports on the NFS server machine.    Blank out any usernames or passwords, change IP addresses to N.N.N.N, change hostnames to NFSSERVER and NFSCLIENT, but really, the actual contents help a lot more than what we've been doing.

 

If that's unacceptable, then I'm sorry, I can't help anymore than I already have.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#7 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:11:39 PM

Posted 04 February 2016 - 01:28 PM

DefaultGateway was setting up a samba share in this thread. So maybe he is getting commands mixed up? I'm not familiar with sharing folders using NFS, so not much help on that unfortunately.

 

I thought we got your samba working DefaultGateway, why the switch to using this way instead?


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#8 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 04 February 2016 - 03:47 PM

That would make sense for the syntax in fstab, but only if the "[Network File System]" field actually says cifs.

Kind of my point about seeing the actual contents of the files :)

Export via NFS would be more Unix-like probably a bit better performance at the expense of not being mountable on Windows unless you have an NFS client for Windows.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#9 DefaultGateway

DefaultGateway
  • Topic Starter

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 05 February 2016 - 03:44 AM

Thank you both for replying. :)

About the //, I have succesfully mounted a Samba Share that way. (=> SMB / CIFS)

About changing to the 'host:dir' format, it returns mount: special device 172.16.1.x:abc does not exist

 

Server with NFS and Samba = 172.16.1.x

NFS Client = 172.16.2.x

 

CIDR is /24, so last number of IP doesn't matter, which is presented here as a "x".

 

On 172.16.1.x doing "sudo showmount -e", it gives:

Export list for NFSSERVER:

/yyy/abc 172.16.2.0/24

 

On 172.16.2.x doing "sudo showmount -e", it gives:

clnt_create: RPC: Program not registered

 

On 172.16.2.x doing "sudo showmount -e 172.16.1.x" it gives:

Export list for 172.16.1.x:

/yyy/abc 172.16.2.0/24

 

172.16.2.0 is a Network Address.

 

On NFSSERVER:

# /etc/exports: the access control list for filesystems which may be exported

#               to NFS clients.  See exports(5).

#

# Example for NFSv2 and NFSv3:

# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_sub$

#

# Example for NFSv4:

# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)

# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)

#
 
/yyy/abc 172.16.2.0/24(rw,sync)

On NFSCLIENT:

# /etc/fstab: static file system information.

#

# Use 'blkid' to print the universally unique identifier for a

# device; this may be used with UUID= as a more robust way to name devices

# that works even if disks are added and removed. See fstab(5).

#

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    nodev,noexec,nosuid 0       0

# / was on /dev/sda1 during installation

UUID=() /               ext4    errors=remoun$

# swap was on /dev/sda5 during installation

UUID=() none            swap    sw           $

/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
 
//172.16.1.x/SAMBA /SAMBA cifs username=(),password=() 0 0
172.16.1.x:abc /local/mountpoint auto username=(),password=() 0 0

Btw, I don't need to see the NFS Share from Windows OS, Samba is a different story, and I do see my Samba Share from Windows OS.

@DeimosChaos, I'm not actually switching, this is part of an assignment for school. And don't worry, this is not an assignment where you may not ask questions to teacher or classmates.

For this assignment, the students are free to ask questions to everyone.

 

This is my longest post ever on this forum :graduate: :lol:


Edited by DefaultGateway, 05 February 2016 - 03:50 AM.


#10 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 05 February 2016 - 09:09 AM

Ok, now we're getting somewhere with having data to work with.  The sudo showmount -e 172.16.1.x output from your NFS client indicates that it sees it and should be able to mount it.

On the NFS client, does sudo mount /local/mountpoint return an error now?  If it does, try entering this from a terminal:

 

sudo mount 172.16.2.x:/yyy/abc /local/mountpoint

 

and let us know.  I'm thinking the username and password options in fstab are not valid for nfs and the server is exporting /yyy/abc not abc.

 

Sorry if I sounded a bit harsh, but helping this kind of stuff being exact makes getting to an answer easier on all parties.

 

"man nfs" or google "nfs client mount options" 


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#11 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:11:39 PM

Posted 05 February 2016 - 09:50 AM

 

@DeimosChaos, I'm not actually switching, this is part of an assignment for school. And don't worry, this is not an assignment where you may not ask questions to teacher or classmates.

For this assignment, the students are free to ask questions to everyone.

 

Ah, I thought I remembered something about classes before. No worries :)


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#12 DefaultGateway

DefaultGateway
  • Topic Starter

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 05 February 2016 - 10:03 AM

@mremski

Thank you very much for replying. :) :graduate:

This command has helped me:

sudo mount 172.16.2.x:/yyy/abc /local/mountpoint

Only it was not 172.16.2.x, but 172.16.1.x

Because 172.16.2.x is the CLIENT and the Folder I want to mount is on the SERVER. (=> 172.16.1.x)

The mounting is now done by not using "/etc/fstab", but that's not a problem.

 

@DeimosChaos

This is the topic you are referring to. :lol:

http://www.bleepingcomputer.com/forums/t/598479/samba/ (This was also a school assignment, where it's free to ask questions.)



#13 DeimosChaos

DeimosChaos

  • BC Advisor
  • 1,420 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:United States, Delaware
  • Local time:11:39 PM

Posted 05 February 2016 - 10:14 AM

Ah right, haha.

Glad you got everything working!


OS - Ubuntu 14.04/16.04 & Windows 10
Custom Desktop PC / Lenovo Y580 / Sager NP8258 / Dell XPS 13 (9350)
_____________________________________________________
Bachelor of Science in Computing Security from Drexel University
Security +


#14 mremski

mremski

  • Members
  • 493 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:11:39 PM

Posted 05 February 2016 - 10:41 AM

Sorry about that.  You got it correct:  execute on the client, give the address of the server.  I'm guessing it's the options in /etc/fstab, try just using the word defaults instead of the username,password you have.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#15 DefaultGateway

DefaultGateway
  • Topic Starter

  • Members
  • 187 posts
  • OFFLINE
  •  
  • Local time:05:39 AM

Posted 05 February 2016 - 01:23 PM

Thank you again, using the word "defaults" in "/etc/fstab" and then "sudo mount -a" didn't give any errors.

Btw, my Samba mount rule does work with username and password, so there I don't need to use "defaults".

 

Cheers,

DefaultGateway






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users