Solaris Troubleshooting NFS : error ‘cp: cannot create : Permission denied’

When trying to copy a file across an NFS mount point the error “Permission denied‘ is reported.

nfs client# cp /etc/release <nfs mount pt>
cp: cannot create <nfs mount pt>/release: Permission denied

This error can happen if the shared (exported) directory on the NFS server, the one you are trying to copy the file to doesn’t have ‘write’ rights for the specific user. Note. This should not be confused with how the directory was shared out.  See example below.
In the example below the directory was shared out with ‘rw’. This would make one think that all is well but the problem is actually with the physical directory’s permissions.

nfs server# share
–               /shared dir>   rw   “”

Notice in the output below only ROOT has ‘write’ (w) rights to the NFS mounted directory. This would allow ROOT to copy/delete files but ALL other users would be restricted.

nfs server# ls -ld <shared directory>
drwxr-xr-x   3 root     root         512 Apr  4 13:27 <shared directory>To resolve, just add ‘write’ (w) rights for the specific user(s).  As in the case below, ‘write’ (w) rights were provided so ALL users can copy/delete files to/in the shared directory.

Note: Adding ‘write’ (w) permissions to the shared directory will not allow you to delete any existing files. You will need to add the ‘write’ (w) rights recursively [-R] so each existing file also receives the same rights.

nfs server# chmod [-R] 777 <shared directory>

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

5 Responses

  1. Laxxi says:

    Hi Ram,

    Please guide me how can I provide Read write access to a Fs on client  only to users root and oracle 

    where do i need to mention the users in the below command on master server:
    share -F nfs -o rw=client masterser:/filesystem /mountpoint.

    Thanks!!
    Laxxi

  2. Ramdev Ramdev says:

    pleae try      —             share -F nfs -o rw=oracle:root /filesystem

  3. venkat says:

    hi ram,

    client side as a ROOT i am not able to write anything
    ls -ld
    drwxrwxr-x 15 oracle dba 1024 Dec 12 06:31 /BACKUP
    Showmount -e ee.xx.yy.zzz
    /BACKUP (everyone)

    when i am writing any thing it showing that root@xyzDB # touch bb
    touch: cannot create bb: Permission denied

    i checked Serverside /etc/dfs/dfstab it is shared with
    share -F nfs -o rw -d “BACKUP” /BACKUP

    dfmounts
    RESOURCE SERVER PATHNAME CLIENTS
    – XYZMDB1 /BACKUP XYZPRREPDB

    so can you please suggest me what exactly the problem

  4. Ramdev Ramdev says:

    Venkat, “root on nfs-client” is not equals “root on NFS server” … it will be just treated as Nobody account. the /BACKUP has r-x permission for others and the “nobody” ID will be treated as others for this directory, that’s the reason for permission denied.

    If you want to make “root on clients” equivalent to “root on NFS server”, you have to share using following options ‘ share -F nfs -o rw,root=clientname -d “BACKUP” /BACKUP ‘ .

  1. September 16, 2015

    […] Read – error ‘cp: cannot create : Permission denied’ […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us