# Samba share browsable, but cant open files.



## olav (Apr 25, 2010)

I'm trying to configure my first samba share. So far I can browse files, create folders and create "empty" files.

I cant open files, I cant copy over files and I cant copy files from the samba share. This happens with both Ubuntu(Nautilus) and Windows 7.
My smb.conf looks like this:

```
[global]
	server string = Samba Server
	log file = /var/log/samba/log.%m
	max log size = 50
	min receivefile size = 131072
	socket options = TCP_NODELAY SO_SNDBUF=65536 SO_RCVBUF=65536
	dns proxy = No
	aio read size = 1
	aio write size = 1
	use sendfile = Yes

[smil]
	path = /home/olav
	valid users = olav
	admin users = olav
	write list = olav
	read only = No
	map readonly = no
```

What am I doing wrong?


----------



## JimW (Apr 25, 2010)

A few things to check....

Did you add a Samba account for the user with *smbpasswd*? If not, do the following as root...


```
smbpasswd -a olav
```

Make the password the same as the FreeBSD login password (for convenience).

You also didn't set security level in your *Global* section of the *smb.conf* file. Add the following (considering it seems you want user level security)....


```
security = user
```

That might fix your problem. (Also make sure the user olav owns the directory */home/olav*)


You might also want to add something like the following to the share config part of your *smb.conf* file...


```
writable = Yes
 available = Yes
 create mode = 0644
 directory mode = 0754
```

The "mode" statement will keep your newly created files from being tagged executable. You can adjust to your liking.

Good Luck.


----------



## JimW (Apr 25, 2010)

Oh yeah....

I forgot to mention that you need to restart Samba every time you make a change to the *smb.conf* file. You can do that without a reboot by executing the following as root....


```
/usr/local/etc/rc.d/samba restart
```

It might also be a good idea to add a "workgroup" line to the *Global* section of your *smb.conf* file. Make it whatever workgroup name your Windows machines use.

E.g.


```
workgroup = Workgroup
```

Good Luck


----------



## phoenix (Apr 26, 2010)

If possible, use *reload* instead of *restart*.  Restart will close all active SMB connections, potentially leading to data loss if you have lots of connected clients.  

For home use, or where you are the only connecting, using restart is safe.


----------



## olav (Apr 26, 2010)

I've done all of your suggestions, still no change. Could this be a firewall issue? I've installed ipfw. I've also created a test folder which I chmod 777, cant copy or read from the folder either


----------



## FBSDin20Steps (Apr 26, 2010)

Maybe this could be an answer http://forums.freebsd.org/showthread.php?t=8515&highlight=samba+windows


----------



## JimW (Apr 27, 2010)

olav said:
			
		

> I've done all of your suggestions, still no change. Could this be a firewall issue? I've installed ipfw.



Have you tried Samba with IPFW temporarily disabled?

Did you set up your AIO support correctly? The thread link below has more info in that regard....

http://forums.freebsd.org/showthread.php?t=9187

What version of Samba are you using? What version of FreeBSD?


----------



## Ruler2112 (Apr 27, 2010)

Check the permissions on the box you're connecting to to ensure read capability to the user that samba is using to connect as.


----------



## olav (Apr 27, 2010)

Thanks to your great suggestions, I figured it out!

It was the options

aio read size = 1
aio write size = 1

that caused my problems, commenting them out and restarting samba helped.
Samba speed is ok, averaging around 25-30MB/s, full disk speed is 40MB/s.
It is at least a lot faster than NFS, getting just 10MB/s there. File system is ZFS.


----------

