# write on nfs server and automount



## daff (Jun 23, 2010)

Hi all

I actually have some problems configuring a nfs server

in /etc/rc.conf, i have :

```
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
mountd_flags="-r"
```

in /etc/exports : 

```
/usr -alldirs -maproot=root 192.168.1.10
```

on Os X to mount the shared folder I type :
`mkdir /Volumes/dev`
`mount dev:/usr /Volumes/dev`

the problem is when nfs server starts, the shares are not available, it says permission denied
I must restart mountd for them to be available `/etc/rc.d/mountd restart`
So I'd like to know how to be sure the shares are always available on startup

the other problem is that I can't write from Os X, I thought maproot=root will do the trick, but it doesn't seem so

any ideas?


----------



## vivek (Jun 24, 2010)

The simply solution is to add os x user (let us say you login as joe on os x) to FreeBSD and grant that user NFS permission. This should solve the problem.


----------



## daff (Jun 24, 2010)

i added the correct user (joe) to freebsd and put it in wheel group
then in /etc/exports

```
/usr -alldirs maproot=joe 192.168.1.10
```
but it doesn't work

i also tried 
[cmd=]chown -R joe:wheel /usr[/cmd]
but still no write privileges in client


----------



## JimW (Jun 27, 2010)

Maybe try .....


```
/usr -alldirs -mapall=joe 192.168.1.10
```

Maybe *maproot* would also work too.... but I was under the impression you had to have that dash (-) in front of your option statements like *-maproot, -mapall, -alldirs*, etc.

I could be wrong. Give it a try.


----------



## hassu (May 17, 2011)

I can read files fine from my FreeBSD server, with MacOSx client. But I cannot write anything? I've mounted it in MacOS [cmd=]mount -t nfs 192.168.2.102:/usr/home/johndoe /usr/home/macJohnDoe[/cmd] but I cannot write to it?

Where I configure the write permissions so that the client machines can write to my FreeBSD server? I don't know if the permissions are right or wrong in my BSD or my Apple Mac?

in /etc/rc.conf I have following lines related to NFS:


```
nfs_server_enable="YES"
rpcbind_enable="YES"
mountd_flags="-r"
```

my /etc/exports file:


```
/usr/home/johndoe -alldirs  192.168.2.100 192.168.2.103 192.168.2.104
```

in /etc/hosts.allow I've changed couple of lines: (bolded)


```
# Allow anything from localhost.  Note that an IP address (not a host
# name) *MUST* be specified for rpcbind(8).
ALL : localhost 127.0.0.1 : allow
# Comment out next line if you build libwrap without IPv6 support.
[B]#ALL : [::1] : allow[/B]
[B]ALL : 192.168.2.100 : allow[/B]

# Rpcbind is used for all RPC services; protect your NFS!
# (IP addresses rather than hostnames *MUST* be used here)
[B]rpcbind : 192.168.2.100/192.168.2.255 : allow[/B]
#rpcbind : 192.168.2.100/255.255.255.224 : allow
#rpcbind : ALL : deny
```


----------



## hassu (May 17, 2011)

Pff sorry, my mistake. It was the *-maproot=root* flag that I was missing :r


----------



## ThunderWolf (Jul 8, 2012)

Thank you for the help hassu, but the symbolic link was only half the problem. This line gives the same as before:

```
/usr/home -alldirs 192.168.0.6(rw)
```
error msg:

```
mount.nfs: access denied by server while mounting 192.168.0.3:/usr/home/user
```
removing "(rw)" from the line mounts without error:

```
/usr/home -alldirs 192.168.0.6
```
, but it only give me the default read access.
Adding -maproot=user to the line gives me all access though like this:

```
/usr/home -alldirs -maproot=user 192.168.0.6
```
, so again thank you for helping me solve this.

"O" and you wanted to know my /etc/exports permissions:

```
rw-r--r--
```


----------

