# NFS shares

## GNUtoo

How do i set up NFS on:

*A knoppix server

*A gentoo client

----------

## RayDude

 *new_to_non_X86 wrote:*   

> How do i set up NFS on:
> 
> *A knoppix server
> 
> *A gentoo client

 

I'm ignoring the knoppix thing. I don't do knoppix.

There is tons O information on this all over the place on the web. NFS has been around longer than windows...

But, for the sake of pointing you in the right direction, I'll show you my config files for my home file server.

Of course it goes without saying that you have to have NFS Server compiled into the kernel or as modules on the server (and NFS client compiled onto the client, etc.)

You also need to have emerged nfs-utils.

Here's the file that tells the server what to share:

/etc/exports:

```
# /etc/exports: NFS file systems being exported.  See exports(5).

/server         192.168.0.0/24(rw,sync)

```

All my stuff is located in /server so I'm sharing it to everyone on my subnet (but not to the internet, just in case I goof my firewall up).

This would allow a hacker who gets onto my wireless the ability to mount it, but with WPAPSK, I don't think that's likely to happen.

Like my Step-Father always says, "A lock only keeps an honest man honest."

Anywho: on to the next thingy.

Permissions.

Permissions are very important... The user names / IDs must match for users on both the server and the client. You can use nisplus, but its a waste of time if you've only got a couple of users. I just make sure that I'm user 1000 and my wife is user 1001.

Then I set all the permissions for /server to look like this, for example:

```
 372 -rwxrw-r--   1 <my_user_name> users  380928 Nov 20  2004 putty.exe
```

This enables any user to read or write the folder. This is a wee bit dangerous if the wife goes on a deleting frenzy, but she's trustworthy. That reminds me I need to put a DVD burner on the server and put some backup software on it too... I'll have to post about that this afternoon.

The way you do this as root is:

```
cd /

mkdir server

chown <my_user_name>:users server
```

Then I should populate all the files while logged in as myself.

If I create them as root, then I'll need to change the owners on all the files, I do it like this:

```
cd /

chown -R <my_user_name>:users server
```

Now I have to start NFS at start up on the server:

```
rc-update add nfs default
```

As for client side, its about as complex. I use autofs to automount the nfs folder. I like automount for its NFS and cdrom abilities.

Obviously autofs needs to be enabled in the kernel of the client machine, as well as the NFS client.

(you can stick with NFS V3, I don't know of any advantages to the currently experiemental NFS V4.)

Here are the important files for autofs...

```
 cd /etc/autofs

cat auto.master

# $Id: auto.master,v 1.3 2004/12/09 08:25:48 robbat2 Exp $

# Sample auto.master file

# Format of this file:

# mountpoint map options

# For details of the format look at autofs(8).

#/net   /etc/autofs/auto.net

/mnt    /etc/autofs/auto.misc

#/home  /etc/autofs/auto.home
```

```
 cat auto.misc

# $Id: auto.misc,v 1.2 2002/10/27 05:21:15 bcowan Exp $

# This is an automounter map and it has the following format

# key [ -mount-options-separated-by-comma ] location

# Details may be found in the autofs(5) manpage

#boot           -fstype=ext2                            :/dev/hda1

cdrom           -fstype=iso9660                         :/dev/cdrom

floppy          -fstype=auto,gid=users,umask=002   :/dev/fd0

server          -fstype=nfs                             server:/server

usb_key         -fstype=vfat,gid=users,umask=002   :/dev/sda1
```

You'll need to emerge autofs, and rc-update add autofs default.

I don't have nfs-utils installed on my client. I don't think its necessary.

I may be missing something, if you have problems, please ask.

Raydude

----------

## GNUtoo

The specific application that use NFS is a temporary partimage thing in order to backup a partition(to expand my storag capacity(5GB is not enough))

so i don't need all this permanant mouting and security

*i tryed to do this with samba sucessfully with the gentoo part but... uncessfully with the windows part (anti-virus was checking this very huge file and get the system unusable)

The problem in nfs is that i've read a lot of tutorials but i can't figure out how to browse trough the shares of a computer(that i can do with samba) in order to determine:

*if evrything works

*what is shared

ps:i think that the lock keeps the honest man honest not because it can't be defeated but it makes an enormous fronteer between picking/wroting the lock and just simply pass the door

----------

## RayDude

 *new_to_non_X86 wrote:*   

> The specific application that use NFS is a temporary partimage thing in order to backup a partition(to expand my storag capacity(5GB is not enough))
> 
> so i don't need all this permanant mouting and security
> 
> *i tryed to do this with samba sucessfully with the gentoo part but... uncessfully with the windows part (anti-virus was checking this very huge file and get the system unusable)
> ...

 

I'm not sure its possible to browse an NFS server... There may be a way I just don't know how to.

If you just want to temporarilly mount nfs partitions, its even easier.

Don't worry about autofs, just set up your exports on the server, and then on the client: mount -t nfs server:share_dir /mnt/server (...)

NFS is pretty easy to use. Once you get the root folder mounted you can search all the subfolders as if it were a physical hard drive.

Raydude

:Edited to fix bonehead mount syntax mistake:

----------

## GNUtoo

i find a program:

showmount

but it says:

mount clntudp_create: RPC: Program not registered

----------

## RayDude

 *new_to_non_X86 wrote:*   

> i find a program:
> 
> showmount
> 
> but it says:
> ...

 

You need to start portmap. I think its included with nfs-utils.

You can add it to the default run level using rc-update.

Raydude

----------

## GNUtoo

i've done

mount -t nfs //theIP/local_share_dir /mnt/nfs/folder

mount -t nfs //theIP/ /mnt/nfs/folder

(after starting lisa and portmap)

and i've the following error

```
mount: directory to mount not in host:dir format

```

what does it meens?

do i miss a step?

----------

## RayDude

 *new_to_non_X86 wrote:*   

> i've done
> 
> mount -t nfs //theIP/local_share_dir /mnt/nfs/folder
> 
> mount -t nfs //theIP/ /mnt/nfs/folder
> ...

 

My bad. I was thinking samba...

The correct syntax is:

```
mount -t nfs server:share /mnt/directory
```

Raydude

----------

## GNUtoo

i think it will work

i just need to stuudy the howto to allows the accesfrom another computer

----------

