# nfs:  Permission denied for root?

## Gentree

Hi,

I'm a bit confused. root can't modify files on rw nfs mount:

```
bash-3.2#!$ -m

nfsstat -m

/mnt/nfs from linbox:/tmpd/arm/nfs/debs

 Flags: rw,vers=3,rsize=131072,wsize=131072,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=linbox

bash-3.2#ls -ail /mnt/nfs

total 25

251112 drwxr-xr-x 15 root root    19 2007-08-03 17:40 .

 74529 drwxr-xr-x 20 prof users   22 2007-04-03 20:32 ..

251113 drwxr-xr-x  2 root root    60 2006-11-16 19:05 bin

251172 drwxr-xr-x  2 root root     4 2006-11-16 19:07 dev

251175 drwxr-xr-x  8 root root    23 2007-03-06 21:50 etc

251234 -rw-r--r--  1 root root     0 2006-12-19 21:47 fastboot

251691 -rwxr-xr-x  1 root root  8364 2007-08-03 17:40 hand-rolled.cgi

251235 drwxr-xr-x  2 root root     2 2006-11-16 19:08 initrd

251236 drwxr-xr-x  3 root root    53 2006-11-16 19:09 lib

251430 drwxr-xr-x  3 root root     3 1970-01-01 01:07 mnt

251432 drwxr-xr-x  2 root root     2 2004-08-04 00:05 proc

251433 drwxr-xr-x  2 root root     3 2007-08-04 17:13 root

251434 drwxr-xr-x  2 root root    36 2007-06-30 00:02 sbin

251687 -rw-r--r--  1 root root     0 2007-08-03 17:32 test

251686 -rw-r--r--  1 root root     0 2007-08-03 17:29 test.arm

251469 drwxr-xr-x  2 root root     6 2007-08-03 17:41 tmp

251470 drwxr-xr-x  5 root root     5 2005-10-22 01:41 usr

251546 drwxr-xr-x  8 root root     8 1970-01-01 02:22 var

251560 drwxr-xr-x  3 root root     3 2004-08-04 00:05 www

bash-3.2#touch !$/test

touch /mnt/nfs/test

touch: cannot touch `/mnt/nfs/test': Permission denied

bash-3.2#whoami

root

bash-3.2#hostname

linbox

bash-3.2#
```

I get full access from the remote machine via nfs but when I mount locally I seems to be mounted ro despite what nfsstat reports.

I don't see any mention of such a restriction in the doc , is there some other cause I'm overlooking?

TIA, Gentree.   :Cool: 

----------

## didymos

See the exports man page.  There's something it does by default, "root squashing", which could be the issue.

----------

## Gentree

Thanks very much , that was what I needed. 

I'd tried to check to see what that option did already but it's not mentioned in man nfs.    :Embarassed: 

Late party last night , so nural links seem not have reknitted fully yet. 

Thanks for you help.

----------

## richard.scott

 *didymos wrote:*   

> See the exports man page.  There's something it does by default, "root squashing", which could be the issue.

 

fab, this saved my day too!

I've just got LiveCD booting via PXE/NFS working as I needed "no_root_squash" in my NFS setup!  :Smile: 

----------

## Hu

 *Gentree wrote:*   

> 
> 
> bash-3.2#touch !$/test
> 
> touch /mnt/nfs/test
> ...

 

I know this is an old and solved thread, but since it was recently resurrected, I should point out that if the mount was really read-only, you should get Read-only filesystem, not Permission denied.

----------

## richard.scott

 *Hu wrote:*   

> I know this is an old and solved thread, but since it was recently resurrected, I should point out that if the mount was really read-only, you should get Read-only filesystem, not Permission denied.

 

Your correct in saying that you should get a "read only" file system that mounts but in my case I didn't so I was offering my thanks for the correct suggestion that fixed my issue (hence me resurrecting the thread).

I was trying to mount an NFS share via genkernels linuxrc script the initrd at boot time. I was having "permission denied" errors and needed the "no_root_squash" option on the NFS server to enable the client to mount correctly.

Think of it as a LiveCD being booted over PXE being served from NFS and not a CD Drive  :Smile: 

Now I can install Gentoo with out needing any local boot media!

It's enabled me to post this bug report about Genkernel:

https://bugs.gentoo.org/show_bug.cgi?id=246759

So fingers crossed our hard work gets fed back to the community  :Smile: 

----------

## Hu

 *richard.scott wrote:*   

> 
> 
> Your correct in saying that you should get a "read only" file system that mounts but in my case I didn't so I was offering my thanks for the correct suggestion that fixed my issue (hence me resurrecting the thread).

 

Right.  I understood why you resurrected it, and the nature of your problem.  I wanted to explain that I only posted my note since the thread was recently resurrected.  If it had stayed dead, I would have let the original poster's misstatement stand, but since people are more likely to find recently touched posts, I wanted to make sure that anyone who sees this thread understood the distinct error messages between a read-only NFS mount and a root-squashed NFS mount.

 *richard.scott wrote:*   

> It's enabled me to post this bug report about Genkernel:
> 
> https://bugs.gentoo.org/show_bug.cgi?id=246759
> 
> So fingers crossed our hard work gets fed back to the community 

 

At nothing else, people might find your bug and take the solution from it, even if the patch is never picked up.  The forum supports a [bug] tag that can be used to link to bugs.gentoo.org.  However, it is mainly about saving typing, which I suppose does not matter much if you have the URL handy from recently accessing it.

----------

