# Problem with NFS

## genmurphy

Hello,

I am trying to mount a directory with NFS between two Gentoo boxes that are on my network. The server has the address: 192.168.0.100 and the client: 192.168.0.101.

I already have a working SSH link between the two.

On the server side:

in /etc/exports, I have:

/mnt/bigfoot 192.168.0.101(ro)

in /etc/hosts.allow, I have:

portmap: 192.168.0.101

lockd: 192.168.0.101

rquotad: 192.168.0.101

mountd: 192.168.0.101

statd: 192.168.0.101

in /etc/hosts.deny, i have:

lockd:ALL

mountd:ALL

rquotad:ALL

statd:ALL

if I rpcinfo -p, it gives me:

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100024    1   udp  32772  status

    100024    1   tcp  32801  status

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100021    1   udp  32773  nlockmgr

    100021    3   udp  32773  nlockmgr

    100021    4   udp  32773  nlockmgr

    100021    1   tcp  32802  nlockmgr

    100021    3   tcp  32802  nlockmgr

    100021    4   tcp  32802  nlockmgr

    100005    1   udp    983  mountd

    100005    1   tcp    986  mountd

    100005    2   udp    983  mountd

    100005    2   tcp    986  mountd

    100005    3   udp    983  mountd

    100005    3   tcp    986  mountd

On the client side:

rpcinfo -p 192.168.0.100 gives me the same result as on the server.

if I try to mount the directory with NFS:

mount -t nfs 192.168.0.100:/mnt/bigfoot /mnt/externe

I get:

mount: 192.168.0.100:/mnt/bigfoot failed, reason given by server: Permission denied

Please, help me if you can...

----------

## dhunt

I haven't played around with nfs for awhile but it not anything to do with the user permissions (ie the user you are trying to mount from) has permission to actually see the directory.

----------

## genmurphy

Well, it is the first time I am trying to use NFS. How can I check (define ?) if the root of the client has the right to mount/view the directory of the server?

----------

## dhunt

Are you trying to access this as root, If that is the case nfs is not letting you.

You need to add the following to your exports file

/mnt/bigfoot 192.168.0.101(ro,no_root_squash)

Otherwise it may have something to with uid's been different for both computers.  (You do have the user setup for both computers??)

Let me know how you get on.

----------

## Genone

first step: check /var/log/messages (or whatever your syslogger uses) on the server for a more detailed error message

----------

## genmurphy

For Genome:

Mar 11 19:38:11 mbox rpc.mountd: refused mount request from 192.168.0.101 for /mnt/bigfoot (/): not exported

For Dhunt:

>Are you trying to access this as root, If that is the case nfs is not letting you.

Well, before accessing, I would like to mount the directory and just root can do that.

>You need to add the following to your exports file /mnt/bigfoot 192.168.0.101(ro,no_root_squash)

Make no difference

>Otherwise it may have something to with uid's been different for both computers.

> (You do have the user setup for both computers??) 

How can I check/change the uid?? (remember, I am a newbie. Even if I am using Gentoo for more than a year, I am still considering myself a newbie)

>Let me know how you get on.

Well for now, it still does not work...

----------

## ihad

Hi,

Please do a exportfs and see if

/mnt/bigfoot 192.168.0.101

shows up. If not... Did you actually tell the nfs-server to export this directory with exportfs -a or did you merely edit /etc/exports?

Please forgive me if I'm merely stating the obvious.. But sometimes the obvious isn't that what comes to mind...

Regards...

----------

## genmurphy

I have done :

exportfs

And the result is:

/mnt/bigfoot    192.168.0.101

----------

## ihad

Hi,

Everything seems to be alright for me. One thing that crosses my mind is that your're trying to mount a read-only-exported NFS-Filesystem w/o -oro. I don't know for sure if mounting (rw) is the default, but maybe you could give

```

mount -t nfs -oro 192.168.0.100:/mnt/bigfoot /mnt/externe

```

a try...

One other thing that _could_ be a source of your problems is any kind of naming services (dns/the hosts-file etc)... But since you're using IP-addresses I really doubt that this is the case here... AND the syslog-entry doesn't exactly support this theory. I've done some testing myself and I get the very "refused mount request from xxx for xxx (/)" when I try to mount a non-exported share.

Otherwise I'm out of ideas right now...

HTH and regards

----------

## groovin

try changing your hosts.allow to allow ALL and then remove everything from hosts.deny... no, you dont want your final setup to look this way but it helped me figure it out once.

----------

## genmurphy

For ihad:

mount -t nfs -oro 192.168.0.100:/mnt/bigfoot /mnt/externe

gives me:

mount: 192.168.0.100:/mnt/bigfoot failed, reason given by server: Permission denied

For Groovin

I have put:

ALL:ALL 

in hosts.allow and nothing in hosts.deny

and I have got the same depressing:

mount: 192.168.0.100:/mnt/bigfoot failed, reason given by server: Permission denied

----------

## dhunt

Can you tell us what your error logs say. Try running

```
tail -f /var/log/everything/current
```

 on the server

When you try doing the mount from the other computer. That may give us some idea what the problem is.

----------

## genmurphy

It gives:

tail: cannot open `/var/log/everything/current' for reading: No such file or directory

tail: no files remaining

I have no "everything" directory in /var/log

----------

## dhunt

 *genmurphy wrote:*   

> It gives:
> 
> tail: cannot open `/var/log/everything/current' for reading: No such file or directory
> 
> tail: no files remaining
> ...

 

Ok in your /var/log directory do you have a messages file or something similar?? If so run tail -f on it while you do the above.

----------

## genmurphy

It gives:

Mar 13 09:16:34 mbox rpc.mountd: refused mount request from 192.168.0.101 for /mnt/bigfoot (/): not exported

----------

## dhunt

hmm I'm out of ideas too, everything looks alright to me  :Confused: 

----------

## thecooptoo

whats ls -la /mnt/bigfoot 

and exportfs -v |grep 192.168.0.100   on the server 

and whoami on the client 

try chmodding the /mnt/bigfoot  to 777. If it then works its a users/access permissions problem. Once that it sorted chmod it back.

----------

## gcasillo

Anyone figure this out yet? I'm having pretty much the same exact problem.

----------

## thecooptoo

so , on the server , whats the output of 

ls -la /directoryyouwanttoexport

and whats the output of exportfs

----------

## gcasillo

```
gregg@bukowski ~ $ ls -la /mnt/mythtv

total 20

drwxrwxrwx   5 root users 4096 Mar 20 06:12 .

drwxr-xr-x   6 root root  4096 Mar 20 08:47 ..

drwxrwsr-x   2 root users 4096 Mar 21 08:33 livetv

drwxrwsr-x  81 root users 4096 Mar 20 00:39 music

drwxrwsr-x   2 root users 4096 Mar 21 10:12 recordings
```

```
bukowski gregg # exportfs

/mnt/mythtv     192.168.0.0/24
```

----------

## thecooptoo

try making it  on the server 

```

/mnt/mythtv     192.168.0.0/24 (rw,no_root_squash,sync)

```

 (edit)  - I forgot, after changing your /etc/exports file you need to get the server to re-read it

```
exportfs -ra 
```

and then on the client

```

mkdir /mnt/mythtv_mounted  ( just so the various dir names dont get confused) 

 
```

and then try 

```

mount -t nfs server:/mnt/mythtv /mnt/mythtv_mounted

```

----------

## wellwhoopdedooo

I think your problem is that you're using NFS4.

The main issue is, you have to export a root fs that all of the others are contained in. You specify the root fs with the option fsid=0. Here's my exports file:

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

/mnt/NFS4       blah(rw,async,no_root_squash,fsid=0)

/mnt/NFS4/safe  blah(rw,async,no_root_squash,nohide)

/mnt/NFS4/store blah(rw,async,no_root_squash,nohide)

/mnt/NFS4/home  blah(rw,async,no_root_squash,nohide)
```

Then on the client side, you just mount /mnt/NFS4 and it mounts everything. If you want to make it necessary to mount /mnt/NFS4 and then /mnt/NFS4/safe, etc., then take off the nohide option.

Also, you need to have idmapd installed on each machine. I'd recommend just disabling NFS4 in your kernels. The only reason I have it is for ACL support.

----------

## richardash1981

Note that the nfs server needs to be able to do a reverse DNS lookup on each client IP that tries to connect to it,(even with IP addresses or masks in /etc/exports).  If it can't, mount will often time out on the clients, and exportfs will take much longer.

Either add the nfs clients to the DNS or the server's hosts file.

----------

