# How to configure file permissions for written files on my FreeBSD NFS server?



## mrjayviper (Nov 23, 2020)

*TLDR:* When I copy a file from my macOS client to the FreeBSD NFS server, it's written with 777 permission.

In my example below, I want "license.properties" to be owned by myuser:staff and have 664 permissions.

----

T*his is the command I used to mount the NFS share on my Mac*


```
mount -t nfs 192.168.1.229:/mnt/storage-mypc ~/test
```
*
FreeBSD setup:*


```
mypc% ls -al
    total 140
    drwsrwsr-x  10 myuser  staff   11 Nov 23 14:44 apps

    mypc% ls -al apps
    total 66
    -rwxrwxrwx   1 501    staff  232 Nov 10 15:06 license.properties

    mypc% cat /etc/exports
    /mnt/storage-mypc -maproot=myuser -network 192.168.1/24
    /mnt/storage-mypc -maproot=myuser -network 192.168.2/24

    mypc% showmount -e
    Exports list on localhost:
    /mnt/storage-mypc                 192.168.1.0 192.168.2.0

    mypc% cat /etc/rc.conf
    clear_tmp_enable="YES"
    syslogd_flags="-ss"
    sendmail_enable="NONE"
    hostname="mypc"
    wlans_iwm0="wlan0"
    ifconfig_wlan0="WPA DHCP"
    sshd_enable="YES"
    ntpd_enable="YES"
    powerd_enable="YES"
    # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
    dumpdev="NO"
    zfs_enable="YES"

    ######################################
    #mypc

    mountd_enable="YES"
    nfs_server_enable="YES"
    rpcbind_enable="YES"

    ifconfig_re0="inet 192.168.2.1 netmask 255.255.255.0"
```


----------



## jredd (Dec 3, 2020)

permissions handled by the filesystem recognize the uid but the server doesn't.
include your user in nfsserver for uid or map to 'nobody'.

the '-alldirs' option might be what you are looking for here to include subdirs in mount if permissions don't stick.


----------

