0

I'm relatively new to setting up NFS mounts and I'm trying to get things started in the AWS cloud. I ultimately want to have a CentOS box which serves as the NFS server and can have different sorts of machines (Ubuntu or CentOS) access the NFS share with full read/write access. I've got it somewhat working, but right now I can't write to files on the Ubuntu client that weren't created/last modified on the Ubuntu system. (As a test, I just created a text file on the Ubuntu client which was fine. If I then modify it on a CentOS system, I can read it in Ubuntu fine but I can't write to it any more.)

Configuration:

On the CentOS server my /etc/exports file is as follows:

/hello *(rw,async,no_root_squash,no_subtree_check,fsid=0)

(I just used the wildcard for now for ease of access - only systems in my specific AWS security group can actually access the NFS ports.) The config options were somewhat brought together from different guides on the Internets. I read somewhere that the fsid=0 is key to getting the share to be mountable in Ubuntu. I then exported with exportfs -a

On both an Ubuntu and CentOS client, I made the directory (with superuser/as root) /mnt/mymnt then ran:

mount -t nfs4 <MY_CENTOS_SERVER_DNS>.us-west-1.compute.amazonaws.com:/ /mnt/mymnt

to mount the share.

Permissions

On the CentOS server, the shared directory permissions look like:

(from ls -l /:)

drwxrwxrwx.   2 1000 1000  4096 Apr 24 16:13 hello

A directory listing of /hello on the server yields:

total 8
-rw-rw-r--. 1   1000   1000  0 Apr 23 20:21 HELLO_CLIENT
-rw-rw-r--. 1 centos centos 17 Apr 24 16:05 HI_CENTOS
-rw-rw-r--. 1 centos centos 47 Apr 24 16:13 HI_UBUNTU
-rw-rw-r--. 1   1000   1000  0 Apr 24 16:24 TEST2

On the Ubuntu server, the same directory listing yields:

total 16
drwxrwxrwx 2 nobody     nogroup    4096 Apr 24 16:24 ./
drwxr-xr-x 5 root       root       4096 Apr 23 19:07 ../
-rw-rw-r-- 1 nobody     nogroup       0 Apr 23 20:21 HELLO_CLIENT
-rw-rw-r-- 1 nobody     nogroup      17 Apr 24 16:05 HI_CENTOS
-rw-rw-r-- 1 nobody     nogroup      47 Apr 24 16:13 HI_UBUNTU
-rw-rw-r-- 1 nobody     nogroup    0 Apr 24 16:24 TEST2

On a CentOS client, I see the same thing, but with the group nobody instead of nogroup (likely a syntactical thing).

Summary

I'm trying to fully share a directory from CentOS server to both CentOS and Ubuntu clients over NFSv4. I can mount the share but I can't write to files I didn't create on the Ubuntu system on the Ubuntu system. Do I appear to be configuring something incorrectly? Is there a better way to do what I'm trying to do?

5
  • Can you check to which groups your user belongs on the different systems?
    – Hastur
    Apr 24, 2015 at 16:39
  • Sure, they're as follows: centos user on Server: centos adm cdrom dialout floppy video dip audio ubuntu user on Ubuntu client: ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev centos user on CentOS client: centos adm cdrom dialout floppy video dip audio Not sure if there's a specific group they should all belong to but currently don't...
    – Devin
    Apr 24, 2015 at 16:54
  • Hopefully you can read that formatting, tried the best I could!
    – Devin
    Apr 24, 2015 at 16:55
  • Just a try. Let's do again your test: create a text file on the Ubuntu client (see ls -l yourfile on both clients). Then modify it on a CentOS system, verify that you can read it in Ubuntu you cannot write it any more ans see again ls -l yourfile on both client. Edit your question if something is changed. If so maybe you have different user id on the two client and the program you used modified the ownership.
    – Hastur
    Apr 24, 2015 at 17:13
  • Just gave that a try. Seemed to be the same result. Interestingly, when opening that file in vim, it was marked as [readonly] but if I "force-write" (:w!), it will successfully write the changes regardless of system.
    – Devin
    Apr 24, 2015 at 20:04

0

You must log in to answer this question.

Browse other questions tagged .