# [SOLVED] Strange NFS problem

## stobbsm

Here's the issue, and it's got me stumped.

On my server, I export 2 directories. A general "Shared" directory that holds all the music and movies for myself and my wife, all under the group "shared' with 660 permissions on all files and 770 on all directories.

The problem is, mounted on the client, only my account can read anything.

Here is my /etc/exports:

```
/shared/Shared   192.168.0.0/24(rw,no_subtree_check,no_root_squash)

/shared/Photos   192.168.0.0/24(rw,no_subtree_check,no_root_squash)
```

I've double checked GID's and UID's, and they match on both host and client.

Why can my account (who technically owns all the files on the server) read and write, where my wife's account (who is in the group that has read/write permissions) not?

----------

## Jimini

Have you checked, if the ids of users/groups are the same on all systems?

Best regards,

Jimini

----------

## stobbsm

Yes, and they match!

I've solved part of the problem using CIFS instead. Now she can read the files and write, but I'd rather be using nfs.

----------

## Jaglover

Do you have execute permission on directories.

----------

## Hu

He said he did.  Just to be thorough, please run this snippet as root, as stobbsm, and as wife:

```
id; ( c=/path/to/problematic/file; while [[ "$c" != '' ]]; do ls -dln $c; c=${c%/*}; done; ls -dln /)
```

Also, please post the output of nl /proc/mounts ; nl /etc/fstab from each client machine.

----------

## stobbsm

snippet run as stobbsm:

```
uid=1000(stobbsm) gid=1000(stobbsm) groups=4(adm),20(dialout),24(cdrom),46(plugdev),108(lpadmin),121(admin),124(sambashare),1000(stobbsm)

drwxrwsr-- 13 1000 1007 4096 2010-05-30 23:55 /media/Shared_nfs

drwxr-xr-x 5 0 0 4096 2010-05-31 20:06 /media

drwxr-xr-x 23 0 0 4096 2010-05-31 16:42 /
```

snippet run as root:

```
uid=0(root) gid=0(root) groups=0(root)

drwxrwsr-- 13 1000 1007 4096 2010-05-30 23:55 /media/Shared_nfs

drwxr-xr-x 5 0 0 4096 2010-05-31 20:06 /media

drwxr-xr-x 23 0 0 4096 2010-05-31 16:42 /
```

snippet run as my wife:

```
uid=1002(amurlee) gid=1001(amurlee) groups=4(adm),20(dialout),21(fax),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),107(fuse),108(lpadmin),124(sambashare),1001(amurlee),1006(private),1007(shared),1008(photos)

drwxrwsr-- 13 1000 1007 4096 2010-05-30 23:55 /media/Shared_nfs

drwxr-xr-x 5 0 0 4096 2010-05-31 20:06 /media

drwxr-xr-x 23 0 0 4096 2010-05-31 16:42 /
```

nl /proc/mounts:

```
     1   rootfs / rootfs rw 0 0

     2   none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

     3   none /proc proc rw,nosuid,nodev,noexec,relatime 0 0

     4   none /dev devtmpfs rw,relatime,size=2021176k,nr_inodes=505294,mode=755 0 0

     5   none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

     6   /dev/disk/by-uuid/af815445-a925-474f-add3-47c0a982fed4 / ext4 rw,relatime,errors=remount-ro,barrier=1,stripe=32,data=ordered 0 0

     7   none /sys/fs/fuse/connections fusectl rw,relatime 0 0

     8   none /sys/kernel/debug debugfs rw,relatime 0 0

     9   none /sys/kernel/security securityfs rw,relatime 0 0

    10   none /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0

    11   none /var/run tmpfs rw,nosuid,relatime,mode=755 0 0

    12   none /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0

    13   none /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0

    14   /dev/md0 /boot ext2 rw,relatime,errors=continue 0 0

    15   /dev/sdb1 /mnt/clfs ext4 rw,relatime,barrier=1,data=ordered 0 0

    16   server:/shared/Photos /media/Photos nfs rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.102,mountvers=3,mountproto=tcp,addr=192.168.0.102 0 0

    17   //server/Shared /media/Shared cifs rw,mand,relatime,unc=\\server\Shared,username=shared,uid=0,noforceuid,gid=1007,forcegid,addr=192.168.0.102,posixpaths,serverino,acl,rsize=16384,wsize=57344 0 0

    18   binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0

    19   /home/stobbsm/.Private /home/stobbsm ecryptfs rw,relatime,ecryptfs_fnek_sig=4f6510480022bee3,ecryptfs_sig=a414a1807b413457,ecryptfs_cipher=aes,ecryptfs_key_bytes=16 0 0

    20   gvfs-fuse-daemon /home/stobbsm/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

    21   server:/shared/Shared /media/Shared_nfs nfs rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.0.102,mountvers=3,mountproto=tcp,addr=192.168.0.102 0 0

```

nl /etc/fstab:

```
     1   # /etc/fstab: static file system information.

     2   #

     3   # Use 'blkid -o value -s UUID' to print the universally unique identifier

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

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

     6   #

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

     8   proc            /proc           proc    nodev,noexec,nosuid 0       0

     9   # / was on /dev/md2 during installation

    10   UUID=af815445-a925-474f-add3-47c0a982fed4 /               ext4    errors=remount-ro 0       1

    11   # /boot was on /dev/md0 during installation

    12   UUID=264e945f-6e9c-468d-8674-6751a9b060bd /boot           ext2    defaults        0       2

    13   # swap was on /dev/md1 during installation

    14   #UUID=6afd0104-98b2-4dee-95dc-d569c5940cf0 none            swap    sw              0       0

    15   /dev/mapper/cryptswap1 none swap sw 0 0

       

    16   ## NFS Mounts

    17   server:/shared/Shared   /media/Shared_nfs   nfs   defaults   0 0

    18   server:/shared/Photos   /media/Photos   nfs   defaults   0 0

       

    19   ## CIFS Mounts

    20   //server/Shared      /media/Shared   cifs   credentials=/root/.credentials,gid=1007   0 0

       

    21   ## CLFS Mount

    22   /dev/sdb1   /mnt/clfs   ext4   defaults   0 0

```

----------

## Hu

 *stobbsm wrote:*   

> 
> 
> ```
> uid=1000(stobbsm) gid=1000(stobbsm) groups=4(adm),20(dialout),24(cdrom),46(plugdev),108(lpadmin),121(admin),124(sambashare),1000(stobbsm)
> 
> ...

 It is legal, but generally not useful, to give a directory read and not execute, as you did for other on Shared_nfs.  For simplicity, I suggest changing the directory to be 770 as you stated in the original post, rather than the current 2774.

You did not provide the mode on any files within the directory.  The directory permissions you showed look fine, so I wonder if there might be some problem with the permissions on the files.

 *stobbsm wrote:*   

> nl /etc/fstab:
> 
> ```
> 
>      9   # / was on /dev/md2 during installation
> ...

 This looks like an Ubuntu system.

----------

## stobbsm

It is an ubuntu system. The client is ubuntu for the desktop, the server is gentoo.

----------

## stobbsm

Solved the problem!

The directories under Shared didn't have the sticky bit set, so I ran

```
find /shared/Shared -type d -exec chmod 2774 {} \;
```

 and now she can read it fine!

After all my years working with Linux, sometimes I still fall for permission problems.

----------

## Hu

 *stobbsm wrote:*   

> The directories under Shared didn't have the sticky bit set, so I ran
> 
> ```
> find /shared/Shared -type d -exec chmod 2774 {} \;
> ```
> ...

 They still do not have the sticky bit set.  The sticky bit is 01000, not 02000.  You enabled the setgid bit.  You might also have turned on group search at the same time, given the chmod you ran.

----------

