# help fixing Samba



## Josh19 (Aug 30, 2012)

I had samba working fine then I decided to try to set up NFS sharing the same directory; now samba no longer works.  I've gone through the troubleshooting section and it I can't figure out what is going wrong.  I can manually 'mount' the share but can't access anything and when I try to mount it with Nautilus I get "Unable to mount location / Failed to mount Windows share."

I'm really hoping someone here can point me in the correct direction because after spending a week googling and failing to resolve the issue I'm just about ready to do a re-install.

Relevant data (following basically the troubleshooting section of Samba /Diagnosis.
testparm:

```
$ testparm
Load smb config files from /usr/local/etc/smb.conf
max_open_files: increasing sysctl_max (11095) to minimum Windows limit (16384)
rlimit_max: increasing rlimit_max (11095) to minimum Windows limit (16384)
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
	server string = Samba Server
	log file = /var/log/samba/log.%m
	max log size = 50
	dns proxy = No
	idmap config * : backend = tdb

[public]
	comment = %h Shared Public Directory
	path = /server/samba/public
	force user = nobody
	force group = nogroup
	read only = No
	force create mode = 0777
	force directory mode = 0777
	guest ok = Yes
```


```
josh@Lappy2000:~$ smbclient -L 192.168.1.19
Enter josh's password: 
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.1]

	Sharename       Type      Comment
	---------       ----      -------
	public          Disk      beastie Shared Public Directory
	IPC$            IPC       IPC Service (Samba Server)
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.1]

	Server               Comment
	---------            -------
	BEASTIE              Samba Server

	Workgroup            Master
	---------            -------
	WORKGROUP            BEASTIE
```



```
josh@Lappy2000:~$ nmblookup -B beastie __SAMBA__
querying __SAMBA__ on 192.168.1.19
192.168.1.19 __SAMBA__<00>
```

Everything I try at the prompt '\>' gives the same error

```
josh@Lappy2000:~$ smbclient //beastie/public
Enter josh's password: 
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.1]
smb: \> 
NT_STATUS_ACCESS_DENIED listing \*
```

The only thing I've found from Google was a similar fault on Solaris where SELinux was the culprit so I'm completely lost.

If any more info is needed please let me know.  I have all my important files on this server, including about 200 Gb of photos of my wife's recently passed pug and I know if I lost them she'd kill me.  I haven't resorted to rsync because my desktop hdd probably can't hold everything on the server.  I figured that having a mirrored ZFS FreeBSD server would be safe for all our important files but I foolishly didn't consider what would happen if the server somehow failed.

I'm usually pretty good at fixing issues but I'm absolutely stuck on this one.

Thank you in advance.


----------



## SirDice (Aug 30, 2012)

Samba and NFS have nothing to do with each other and can live happy together. I have several directories shared with both Samba and NFS.

I'm guessing you screwed up the permissions on the files you're sharing.


----------



## Josh19 (Aug 30, 2012)

I know they should be able to live together but I didn't change permissions

That was my initial thought too so I tried chmod 777 -R * && chown nobody:nogroup -R * but that didn't help either (also tried nobody:nobody).  I made sure the parent directory, not just the files contained within were also rwx for everyone.  

I do have a gut feeling that it might be permission based but I think I've tried to eliminate all permissions, including using zero filtering as can be seen by my smb.conf output.  

I think I'm going to take a day off from trying to solve this and give it another go tomorrow.

Thank you for looking at it though.


----------



## SirDice (Aug 30, 2012)

Josh19 said:
			
		

> I think I'm going to take a day off from trying to solve this and give it another go tomorrow.


That usually works for me too. 

Try to make your configs as clean as possible. The less options you set the better, only put the stuff in that's needed to get it working. I've found that by adding more and more options I tend to break things. 

Perhaps for future reference, make a backup copy of the config file you're going to mangle. So you know you have a working configuration to fall back on :e


----------



## Josh19 (Aug 31, 2012)

The funny thing is that I was following a guide, as this is my first foray into FreeBSD though not with samba (I'm replacing a Debian mail/file server with a FreeBSD ZFS one), and I had a backup copy of the config file which I tried using to no avail.  

The only other thing I can think of is that I may have changed ownership (of the directories and recursively all the files contained within) while trying to set up NFS.  I tried just going through the guide again too but that didn't work so I assumed it was because of NFS.  I also did, as you suggested, try to eliminate all possible variables in smb.conf with no luck.  

Is there any reason that the basic config file wouldn't work if the parent directory and files contained within were owned by 'nobody:nogroup' (changed in the config file to match); I assumed that was the case when files were 'created' by a client because of the force user/group settings.  I know that's how I had it set up on Debian before this but the guide had it set to 'nobody:nobody'  Could this potentially be the root of my problem?

I'm going to go get a nice hearty breakfast and give this another shot shortly thereafter.  
 Thank you again for your assistance in this matter.


----------



## SirDice (Aug 31, 2012)

Give the files and directories a proper username and group instead of nobody. Just pick any user and group, set directories to 755 and files to 644. That really should be enough, there's no reason to give _everybody_ write access. 

Could probably do this in one go but this is a bit clearer I think..
[cmd=]find /base/dir/ -type d -exec chmod 755 {} \;[/cmd]
[cmd=]find /base/dir/ -type f -exec chmod 644 {} \;[/cmd]


----------

