Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]nfs mounts ok, but no files are shown and permission
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Sun Jul 02, 2017 1:57 pm    Post subject: [SOLVED]nfs mounts ok, but no files are shown and permission Reply with quote

Hi, I'm new to nfs and in need of help cause I cant get my folder to be shared. Running without a firewall

The server has
Code:
root@whiskey ~ #cat /etc/exports
# /etc/exports: NFS file systems being exported.  See exports(5).
/srv/nfs      192.168.1.0/24(rw,fsid=root,no_subtree_check)
/srv/nfs/pictures   191.168.1.0/24(rw,nohide,no_subtree_check)

The pictures folder is a mount --bind to another folder on disk with the following permissions:
Code:

#ls -al /srv/nfs/
total 12
drwxr-xr-x  3 root root  4096 Jul  2 06:50 .
drwxr-xr-x  3 root root  4096 Jul  2 06:50 ..
drwxrwx--- 21 root photo 4096 Jan 24  2015 pictures

And the exports are shown fine here:
Code:

#exportfs -v
/srv/nfs         192.168.1.0/24(rw,wdelay,root_squash,no_subtree_check,fsid=0,sec=sys,rw,secure,root_squash,no_all_squash)
/srv/nfs/pictures
      191.168.1.0/24(rw,wdelay,nohide,root_squash,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)

Now on the client side I run
Code:

rye ~ # mount whiskey:/pictures /media/pictures/
rye ~ # mount  | grep pictures
whiskey:/pictures on /media/pictures type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.143,local_lock=none,addr=192.168.1.19)

So that the mount seems fine. I can check the connection on the server with
Code:

#netstat -tn | grep 2049
tcp        0      0 192.168.1.19:2049       192.168.1.143:730       ESTABLISHED

However ls /media/pictures does not show any files. And attempting to write to disk gives a permission error. Also the directory itself does not have the same permissions shown above:
Code:

rye ~ # echo "hola" > /media/pictures/hola.txt
-bash: /media/pictures/hola.txt: Permission denied
# ls -al /media/
total 12
drwxr-xr-x  3 root root  4096 Jul  2 07:23 .
drwxr-xr-x 22 root root  4096 Jun 28 21:28 ..
-rw-r--r--  1 root root     0 Mar 28 10:26 .keep
drwxr-xr-x  2 root photo 4096 Jul  2 06:50 pictures

(Same if I try with my user in the "photo" group instead of root).

Finally and probably unrelated, if I try to mount with version 3 instead of 4:
Code:

rye ~ # showmount -e whiskey
Export list for whiskey:
/srv/nfs/pictures 191.168.1.0/24
/srv/nfs          192.168.1.0/24
rye ~ # mount -t nfs -o vers=3 whiskey:/srv/nfs/pictures /media/pictures -v
mount.nfs: timeout set for Sun Jul  2 10:55:34 2017
mount.nfs: trying text-based options 'vers=3,addr=192.168.1.19'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.19 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.19 prog 100005 vers 3 prot UDP port 55246
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting whiskey:/srv/nfs/pictures

And in the server logs:
Code:
Jul  2 10:55:17 whiskey rpc.mountd[19896]: authenticated mount request from 192.168.1.143:784 for /srv/nfs/pictures (/srv/nfs)
Jul  2 10:55:17 whiskey rpc.mountd[19896]: request to export directory /srv/nfs/pictures below nearest filesystem /srv/nfs

Any help will be appreciated.


Last edited by potuz on Sun Jul 02, 2017 5:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Sun Jul 02, 2017 4:36 pm    Post subject: Reply with quote

EDIT: Disregard this post, this is simply explained by the original permissions of the directory /srv/nfs/pictures (before the mount --bind option).

Adding a little more info that is really confusing to me: I changed ownership of the export in the server to
Code:
root@whiskey ~ #ls -alh /srv/nfs/
total 12K
drwxr-xr-x  3 root    root    4.0K Jul  2 06:50 .
drwxr-xr-x  3 root    root    4.0K Jul  2 06:50 ..
drwxrwx--- 21 potuz potuz 4.0K Jan 24  2015 pictures

Where the user potuz has
Code:

#id potuz
uid=1000(potuz) gid=1000(potuz) groups=1000(potuz),10(wheel),1004(photo)

And in the client I have
Code:

$ id
uid=1000(potuz) gid=1000(potuz) groups=1000(potuz),7(lp),10(wheel),16(cron),27(video),85(usb),104(wireshark),250(portage),1004(photo)

But still this happens before and after mounting!
Code:

$ ls -alh /media/
total 12K
drwxr-xr-x  3 root    root    4.0K Jul  2 12:24 .
drwxr-xr-x 22 root    root    4.0K Jun 28 21:28 ..
-rw-r--r--  1 root    root       0 Mar 28 10:26 .keep
drwxr-x---  2 potuz potuz 4.0K Jul  2 12:24 pictures
$ mount /media/
$ ls -alh /media/
total 12K
drwxr-xr-x  3 root root  4.0K Jul  2 12:24 .
drwxr-xr-x 22 root root  4.0K Jun 28 21:28 ..
-rw-r--r--  1 root root     0 Mar 28 10:26 .keep
drwxr-xr-x  2 root photo 4.0K Jul  2 06:50 pictures

Which where the previous owners, this is persistent after reboots, so there's somewhere that nsf is saving status.
Back to top
View user's profile Send private message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Sun Jul 02, 2017 5:00 pm    Post subject: Reply with quote

Solved the problem, I failed to add crossmnt to the list of flags.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum