AutoFS

All Windows clients get mounted through autofs. This allows the backuppc backup task to run with 'tar' or 'rsync', which makes it much easier to manage permissions and file and directory excludes.

autofs installation

apt-get install autofs

Client configuration is done in a sub directory to /etc/backuppc, so keeping the autofs and backuppc configuration files in sync is easy. Point a link in autofs configuration directory to the machine configuration file and restart autofs.

# vim /etc/backuppc/autofs.d/samba.autofs
/mnt/machine /etc/backuppc/autofs.d/machine.autofs --timeout=10 --ghost # machine must be resolveable by the DHCP server, check with 'ping machine'

# vim /etc/backuppc/autofs.d/machine.autofs
C -fstype=cifs,ro,credentials=credentials-for-machine-file,uid=backuppc,gid=backuppc ://machine/C\$ # default samba share

# vim credentials-for-machine-file
username=user
password=password

# ln -s /etc/backuppc/autofs.d/samba.autofs /etc/auto.master.d/samba.autofs
# /etc/init.d/autofs restart

Put the credentials file into your home directory with permissions set to 600 and ownership of user. Now you can define machine.pl for backuppc using 'tar' or 'rsync'. Use '/mnt/machine/C' as share name.

Windows XP

  • Disable “simple file sharing” in Folder Options… / View.
  • Windows XP Professional establishes invisible default shares (“C$”, “D$”, etc.) for administration, which BackupPC can use to access the machine. Windows XP Home Edition does not establish admin shares, therefore we need to explicitely share the drives for BackupPC to access the machine.
  • Check 'Start/Settings/Control Panel/Administrative Tools/Local Security Policy' and then 'Security Settings/Local Policies/Security Options/' entry 'Network access: Sharing and Security model for local accounts' from 'Guest only - local users authenticate as Guest' to 'Classic - local users authenticate as themselves'.
  • Enable File and Printer Sharing in Windows Firewall. Edit exceptions…/Change scope to your local server address (e.g. 192.168.1.11/255.255.255.0) Related error message: NT_STATUS_ACCESS_DENIED.
  • Check wether IRPStackSize exists in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters. If it does not, create it. Start with an initial value of Decimal 21, increase by 3 until the conntection works. Related error message: NT_STATUS_INSUFF_SERVER_RESOURCES.

Windows 7, 8, 10

  • Go to Control Panel → Network and Sharing Center → Change advanced sharing settings and:
Turn on network discovery
Turn on file and print sharing
Use user accounts and passwords to connect to other computers (Professional, Ultimate)

Other settings can be left at their default.

  • Windows Vista, 7, 8 and 10 do not enable the C$ shares by default. Run Regedit and modify the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
DWORD LocalAccountTokenFilterPolicy=1
  • If the client is member of a different domain or workgroup than the BackupPC server, you need to indicate the machine's name together with the user name in the credentials file, e.g. DOMAIN\username.
  • If you register the client on a different name on the network than the netbios name of the client, then you need to do the following:
# dhcp server, eg. for dnsmasq:
root@<dhcp-server>:/etc/dnsmasq/dnsmasq.d # vim dnsmasq.local.conf
dhcp-host=00:00:00:00:00:00,machine-name,192.168.1.25 # enter this line to assign the machine with MAC address the name 'machine-name'

On the Windows client, you need to register the alias in the registry:

regedt32
key: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters"
value: "OptionalNames"
content: machine-name
  • Check with the following command the clients on the network:
nmap -sP 192.168.1.0/24
  • Check with the following command from the server wether your Samba Client access works:
smbclient '//clientname/C$' -U username

Interesting articles