# NFS mounting and permissions



## Trojan (May 15, 2009)

Need some help with mounting share using NFS. I configured both the server and client stations with NFS server and NFS client settings respectively. Here is the configs:

```
shlus# grep nfs /etc/rc.conf - on server
rpcbind_enable="YES"
nfs_client_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
mountd_flags="-r"
```


```
$ grep nfs /etc/rc.conf - on client
nfs_client_enable="YES"  
nfs_client_flags="-n 4"
```
On NFS server the /share directory is created.
On NFS client home/trojan/mount directory is created.
Here is the /etc/exports config:

```
/share  -maproot=root  trojan
```

Both on NFS server and client the user *trojan* with GID 1001 and UID 1001 is created.

When I try to mount share under *trojan* user I get the following:


```
$ mount shlus:/share /home/trojan/mount
[udp] shlus:/share: Permission denied
```

What is the cause of it?


----------



## trev (May 18, 2009)

Does 
	
	



```
/etc/rc.d/mountd restart
```
 have any effect?


----------



## SirDice (May 18, 2009)

Trojan said:
			
		

> When I try to mount share under *trojan* user I get the following:
> 
> 
> ```
> ...



You need to be root to mount nfs shares.


----------



## Trojan (May 21, 2009)

trev said:
			
		

> Does
> 
> 
> 
> ...


Unfortunately not. I restarted the daemon on server and client and hadn't any success.



			
				SirDice said:
			
		

> You need to be root to mount nfs shares.


But what about the trivial user who need to mount some share?
At least as I know one can specify the user who will be able to mount the share in /etc/exports file.

I also tried to mount the share under root and here is the result:

```
bsdcli# whoami
root
bsdcli# mount shlus:/share /home/trojan/mount
[udp] shlus:/share: RPCPROG_NFS: RPC: Port mapper failure - RPC: Timed out
[udp] shlus:/share: RPCPROG_NFS: RPC: Port mapper failure - RPC: Timed out
and so on ...
```

May be I made some mistakes in config files (though I configured it according to handbook).
Could you please check my config files. Is it correct or not?


----------



## SirDice (May 21, 2009)

Trojan said:
			
		

> At least as I know one can specify the user who will be able to mount the share in /etc/exports file.


No, you cannot. The last entry on a line in exports is a netgroup(5) not a username. See exports(5)



> I also tried to mount the share under root and here is the result:
> 
> ```
> bsdcli# whoami
> ...



It's not allowing you because your client machine isn't part of the netgroup.


----------



## Trojan (May 21, 2009)

SirDice said:
			
		

> No, you cannot. The last entry on a line in exports is a netgroup(5) not a username. See exports(5)
> 
> It's not allowing you because your client machine isn't part of the netgroup.



What do you mean under meaning "netgroup"? The name of workgroup or domain or what?


----------



## trev (May 22, 2009)

> /share  -maproot=root  trojan



If "trojan" is a user, then you do not understand the format of the exports(5) file. It must either be a machine name or a netgroup(5) name.

The exports file gives remote machines access to file systems on the local machine. Not users.


----------



## Trojan (May 23, 2009)

I changed the username *trojan* for machine name *bsdcli* but still have no success. :q


```
shlus# cat /etc/exports
/share  -maproot=root  bsdcli
```


```
bsdcli# mount shlus:/share /home/trojan/mount
[udp] shlus:/share: RPCPROG_NFS: RPC: Port mapper failure - RPC: Timed out
[udp] shlus:/share: RPCPROG_NFS: RPC: Port mapper failure - RPC: Timed out
[udp] shlus:/share: RPCPROG_NFS: RPC: Port mapper failure - RPC: Timed out
```

One nuance: initially the /etc/exports file wasn't existed because during the installation of system I didn't shoose the system to act as NFS server.

Can it be the cause of this issue?


----------



## trev (May 24, 2009)

Trojan said:
			
		

> One nuance: initially the /etc/exports file wasn't existed because during the installation of system I didn't shoose the system to act as NFS server.
> 
> Can it be the cause of this issue?



Unlikely. Is mountd running on the server? Is there a firewall?


----------



## SirDice (May 25, 2009)

Is bsdcli resolvable? Try to use an IP address. 
You can check if the shares are exported correctly using the showmount(8) command.


----------

