edoceo

Samba Tips and Tricks

This is horribly incomplete :(

Samba can be used to setup a system to share files and printers with Windows and Apple systems. It's also possible to use Samba as an NT4 style Primary Domain Controller (PDC).

Windows Explorer Refresh

Many times the Windows Explorer will not refresh when creating or modifying files on the Samba share. This issue is a Client issue - not a server issue. The following Registry entries should solve the issue. Copy and paste into notepad and save as a registry file (e.g. samba-client.reg).

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Update]
"UpdateMode"=dword:00000000

Windows XP SP2 to Samba Slow Printing Bug

This information was difficult to find on the web so here it is. If printing to the Samba printer is slow from Windows XP with Service Pack 2 the issue is caused by some extra junky registry entries. It's unclear why this causes the problem, who's fault is it anyways? The fix is to remove HKEY_CURRENT_USER\PrintersConnections\*.

# Values 
HKEY_CURRENT_USER\PrintersConnections\DeviceOld = REG_SZ
# Subkeys
HKEY_CURRENT_USER\PrintersConnections\Connections
HKEY_CURRENT_USER\PrintersConnections\DevModePerUser
HKEY_CURRENT_USER\PrintersConnections\DevModes2
HKEY_CURRENT_USER\PrintersConnections\Settings

Samba & Quickbooks §

Intuit doesn't support Quickbooks hosted on a Samba server, there are some workarounds available with Samba which may help. Edoceo has been assisting our clients with Samba/Quickbooks integration for many years, this document represents our experiences.

Filesystem Settings

The filesystem of the host volume for the Samba share's that need to work with Quickbooks have to be set a specific way. The directories that will be the root of the share must be owned by the group that the users who will access are in and they must be able to write. Permissions for world is administrators choice. In the example below the group name is users. The share that quickbooks is on is server, which matches the directory /var/lib/samba/server/.

carbon ~ # cd /var/lib/samba/
carbon samba # stat server
  File: `server/'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 303h/771d       Inode: 246703      Links: 36
Access: (0770/drwxrwx---)  Uid: (    0/    root)   Gid: (  100/   users)
Access: 2005-11-05 21:45:24.000000000 -0800
Modify: 2007-02-01 10:45:08.000000000 -0800
Change: 2007-02-01 10:45:08.000000000 -0800

This will ensure minimal interference from the filesystem for Samba and Quickbooks quirks (Quirkbooks?)

Samba Settings

To assist with Quickbooks files there are many configuration options that can found with a quick Google search. It seems too many. Below is a commented snip from a reference /etc/samba/smb.conf file. An attempt has been made to only list the relevant configuration options. Any setting not specifically listed is set to the Samba default value.

[global]
  # This seems to help a little
  socket options = IPTOS_LOWDELAY SO_SNDBUF=16384 SO_RCVBUF=16384 TCP_NODELAY

[quickbooks]
  # Choose something clever!
  comment = Quickbooks Files
  # Have to add the read/execute on the Other
  force create mode = 0755
  force directory mode = 0775
  # Next two are root's choice
  follow symlinks = no
	wide links = no
  # This is very important for the QB function
  oplocks = no
  path = /var/lib/samba/server
  read only = no

There are also references to the veto opslocks

Quickbooks, Samba, Locked Files and Dirty Exits

Sometimes on a dirty exit of Quickbooks, like when a workstation crashes, the file is then un-openable by the user. The error message will state that The user "XXX" is already logged in on another machine, other users may still be able to open the file. In this instance Quickbooks is confused by the dirty shutdown and Samba still has recorded locks for the files. Look in the locking.tdb, brlocks.tdb and others. and others to validate/verify this (if you really want, use tdbtool, tdbdump). The solution to this issue is below, it stems from some standard Microsoft models: Reboot.

  • Ensure that all Workstations on the network are not accessing any files on the Samba server.
  • Stop the nmbd,smbd services.
  • Reboot the Workstation(s) that are having issues, only this workstation needs to be rebooted. Others will need to be rebooted.
  • During above Reboot(s) remove the brlocks.tdb, connections.tdb, gencache.tdb, locking.tdb, sessionid.tdb files.
    rm /var/cache/samba/{brlocks,connections,gencache,locking,sessionid}.tdb
  • Start the Samba services.

Starting and stopping the Samba services is distribution dependent, on Gentoo (and others) one says /etc/init.d/samba stop. The location of the various .tdb files may vary, Gentoo keeps them in /var/cache/samba/. It's not always necessary to remove the .tdb files but it does no harm, be careful to not remove the other .tdb files that are present.

See Also

ChangeLog

  • 13 Feb 2007 - Added Locked Files section /djb
  • 15 Jan 2007 - Created /djb

Loading Comments from Disqus...