LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can someone help me get started uisng Unix file sharing? (https://www.linuxquestions.org/questions/linux-networking-3/can-someone-help-me-get-started-uisng-unix-file-sharing-327865/)

enigma_0Z 05-27-2005 09:43 PM

Can someone help me get started uisng Unix file sharing?
 
OK, I believe it's called NFS? I need to create some shared files between computers on a network...

I'd also like to ask another question...

If I've got a computer with a NFS share, can I go to another Unix/Linux/BSD machine and mount that share remotely (eg. over the internet)?

tredegar 05-28-2005 03:11 AM

You could start by putting "nfs howto" into google, and following the first link returned. It is not difficult to set up, and will do what you want.

runlevel0 05-28-2005 09:26 AM

Re: Can someone help me get started uisng Unix file sharing?
 
Quote:

Originally posted by enigma_0Z
OK, I believe it's called NFS? I need to create some shared files between computers on a network...

It's easier to do as to explain.
First of all ensure you have NFS support. Ubuntu includes this from the shelf, but in Gentoo you will need to emerge it:
Code:

emerge -avt nfs-utils
There are some more related packages and many howto's tells you how to set them up, but don't bother trying to set this up as the RPC portmapper and
friends are enabled by default.

In Gentoo you will also need to take a glance at the kernel to see if it was build with NFS enabled, it should look like this:
Code:

runlevel0@soviet ~ $ cat /usr/src/linux/.config | grep NFS
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V4=y
CONFIG_NFS_DIRECTIO=y
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V4=y
CONFIG_NFSD_TCP=y

If this is not so, you will need to rebuild the kernel. Use the handy Genkernel application.

If you are running Ubuntu, ensure first of all that the NFS server is not running:
Code:

/etc/init.d/nfs status
Note that in Ubuntu the above can be called nfsd instead of nfs

Server

Once you are sure every thing is in it's place open your favorite editor (Vim, of course) and create/edit the file /etc/exports
Code:

# /etc/exports: NFS file systems being exported.  See exports(5).
/usr/portage 192.168.0.2(rw,no_root_squash,async) 192.168.0.3(rw,no_root_squash,async)

This is my exported portage tree. The syntax is
Quote:

exported_directory IP_1(options) IP_2(options) ...
On Gentoo if you build the NFS support as a module probe for it and (on both distros) enable NFS at startup or in the default runlevel depending on your preferences.
Code:

modprobe nfs
GENTOO:
rc-update add nfs boot

I don't know how to do this in a Ubuntu specific way, but I'm quite sure it's already enabled.

Now start the NFS daemon:
Code:

/etc/init.d/nfs start
Your NFS server is ready and serving.

Clients

On the client side, the only thing you have to do is putting an entry into /etc/fstab such as this:
Code:

192.168.0.1:/srv/portage  /usr/portage    nfs    noauto,rw,rsize=8192,wsize=8192,nolock,_netdev            0    0
This is the syntax:
Quote:

SERVER_IP:/path /local/path nfs options 0 0
The options:
_netdev tells mount not to try to mount it if the server is not available, this avoids delays at boot time.
nolock avoids exclusive locks, specially important for better performance on networks with more than two machines
noauto this makes that the NFS is not mounted at boot, you need to mount it yourself. You can skip this option if you want.
rsize=8192,wsize=8192 a little tweak which improves performance
rw mount read-write, this is up to you.

Now read the NFS and the mount man pages to get more info and tune your system to your likings.

Quote:


I'd also like to ask another question...
If I've got a computer with a NFS share, can I go to another Unix/Linux/BSD machine and mount that share remotely (eg. over the internet)?

Yes you can. A secure approach is restricting the IP in exports or using an SSH tunnel to use NFS. another way is using iptables to stealth the NFS port 2049. A fast and easy way to do this is using Firestarter and simply enabling this port and the client IP in the "stealthed ports" section.

enigma_0Z 05-31-2005 11:05 AM

How would I use an ssh tunnel? Because I'm probably going to be somewhere where I know my computer's IP but not my laptop's


All times are GMT -5. The time now is 03:54 PM.