# Permissions problem with fstab SMB mount



## jmcl (Jan 10, 2011)

Just getting up to speed on freebsd, loving it, but have the following roadblock:

I am trying to mount a windows network share via fstab so I can auto mount on boot.  I can do this via the command line and fstab, but can only get proper read/write permissions from the mount_smbfs command via the -f and -d parameters.  I need help applying these permissions via fstab.

As a first pass, this command works:
`# mount_smbfs -I <serverIP> //USER@SERVER/SHARE /mnt/myshare`
with password prompt.  I can accomplish this through fstab via by adding the following to /etc/fstab:

```
//USER@SERVER/SHARE /mnt/myshare smbfs rw,noauto 0 0
```
and this in /etc/nsmb.conf:

```
[SERVER]
<serverIP>
[SERVER]
password=<myPassword>
```
and then mount it simply via:
`# mount /mnt/myshare`
which can be used in an /etc/rc.d script on boot.

The problem is that non-root users can't write to the contents of /mnt/share as implemented above.  I can fix this when mounting manually via:
`# mount_smbfs -I <serverIP> -f 774 -d 774 //USER@SERVER/SHARE /mnt/myshare`
but can't figure out a way to do this through fstab.  If I try adding options like

```
//USER@SERVER/SHARE /mnt/myshare smbfs rw,noauto,fmask=744,dmask=744 0 0
```
or

```
//USER@SERVER/SHARE /mnt/myshare smbfs rw,noauto,uid=jim,gid=wheel 0 0
```
to /etc/fstab, I get errors that these options are unsupported (this is the suggestion I've seen for linux smb).

How can I pass the 
	
	



```
-f, -d [\CODE] arguments via fstab?  I've also tried 
[CMD=#]mount -f 744 -d 744 /mnt/bear[/CMD]
which I could put in my startup script, but this doesn't work either.

Any help greatly appreciated.

Jim
```


----------



## jmcl (Jan 12, 2011)

Did I violate any kind of newbie etiquette in this post, or is it an issue people haven't commonly dealt with?  I couldn't find a solution after a fair amount of digging on freebsd.org and elsewhere.


----------



## wblock@ (Jan 12, 2011)

Probably no one who has dealt with that has seen it yet.  It's only been one day, and Wednesday is the day of the week most people actually get work done*.
mount_smbfs(8) suggests that you should be able to change the permissions on the mount point (/mnt/myshare) before mounting to do what the -f and -d options are doing.

*:
Monday: hangover recovery.
Tuesday: still not 100%.
Wednesday: work.
Thursday: motivation lacking.
Friday: goofing off.


----------



## quintessence (Jan 13, 2011)

jmcl said:
			
		

> ```
> //USER@SERVER/SHARE /mnt/myshare smbfs rw,noauto,uid=jim,gid=wheel 0 0
> ```
> to /etc/fstab



Hello, 

In FreeBSD style options from your example should be replace by:


```
rw,noauto,-u=jim,-g=root
```

regarding fstab(5).


----------



## jmcl (Jan 14, 2011)

wblock and quintessence, thanks for your replies.  The fstab mod proposed by quintessence did the trick.


----------



## Petri (Jul 30, 2015)

Hi everyone, I’m pretty new to FreeBSD
Been spending a couple of days to figure this out. Thought its time to ask the experts.
FreeBSD machine mounting a Windows share on a Windows 7 machine, my /etc/fstab line is not accepted looking like this.

```
//P3@MEDIASERVER/Storage /mnt/storage smbfs rw,-u=emby,-g=root,-I10.20.30.1 0 0
```

~/.nsmbrc has just two lines as follows:

```
[MEDIASERVER:P3]
password=secretpassword
```

/etc/hosts file has:

```
10.20.30.1    MEDIASERVER
```

And the issue is I just cant write to the mounted disk.
Tried without -u and -g but then no write access but it mounts properly.
With it iI get syntax error.
What do iI need to change to get all users on my FreeBSD get rxw permissions on the mounted filesystem?

Emby is emby-server user name and that server can't fetch metadata and save it on the mounted filesystem.

Don’t mind granting all users on the FreeBSD full rights on that Windows share.
Pardon my English, I’m a Swede...


----------



## SirDice (Aug 3, 2015)

There is no group called root.


----------

