Difference between revisions of "Samba/Tips and tricks"

From ArchWiki
Jump to navigation Jump to search
(Moved password complexity to Samba 4 AD page)
(Moved "Share files without a username and password" section to main Samba article)
Line 6: Line 6:
{{Related articles end}}
{{Related articles end}}
{{Merge|Samba|I cannot see any reason why this section must be separate from the main article.}}
{{Merge|Samba|I cannot see any reason why this section must be separate from the main article.}}
==Share files without a username and password==
Edit {{ic|/etc/samba/smb.conf}} and add the following line:
{{bc|<nowiki>map to guest = Bad User</nowiki>}}
After this line:
{{bc|<nowiki>security = user</nowiki>}}
Restrict the shares data to a specific interface replace:
{{bc|<nowiki>;  interfaces =</nowiki>}}
interfaces = lo eth0
bind interfaces only = true</nowiki>}}
Optionally edit the account that access the shares, edit the following line:
{{bc|<nowiki>;  guest account = nobody</nowiki>}}
For example:
{{bc|<nowiki>  guest account = pcguest</nowiki>}}
And do something in the likes of:
{{bc|<nowiki># useradd -c "Guest User" -d /dev/null -s /bin/false pcguest</nowiki>}}
Then setup a "" password for user pcguest.
The last step is to create share directory (for write access make writable = yes):
[Public Share]
path = /path/to/public/share
available = yes
browsable = yes
public = yes
writable = no
{{note|Make sure the guest also has permission to visit /path, /path/to and /path/to/public, according to [http://unix.stackexchange.com/questions/13858/do-the-parent-directorys-permissions-matter-when-accessing-a-subdirectory http://unix.stackexchange.com/questions/13858/do-the-parent-directorys-permissions-matter-when-accessing-a-subdirectory]}}
=== Sample Passwordless Configuration ===
This is the configuration I use with samba 4 for easy passwordless filesharing with family on a home network. Change any options needed to suit your network (workgroup and interface). I'm restricting it to the static IP I have on my ethernet interface, just delete that line if you do not care which interface is used.
  workgroup = WORKGROUP
  server string = Media Server
  security = user
  map to guest = Bad User
  log file = /var/log/samba/%m.log
  max log size = 50
  interfaces =
  dns proxy = no
  path = /shares
  public = yes
  only guest = yes
  writable = yes
  path = /media/storage
  public = yes
  only guest = yes
  writable = yes
== Build Samba without CUPS ==
== Build Samba without CUPS ==

Revision as of 05:45, 4 May 2016

Merge-arrows-2.pngThis article or section is a candidate for merging with Samba.Merge-arrows-2.png

Notes: I cannot see any reason why this section must be separate from the main article. (Discuss in Talk:Samba/Tips and tricks#)

Build Samba without CUPS

Just build without cups installed. From the Samba Wiki:

Samba has built-in support [for CUPS] and defaults to CUPS if the development package (aka header files and libraries) could be found at compile time.

Of course, modifications to the PKGBUILD will also be necessary: libcups will have to be removed from the depends and makedepends arrays and other references to cups and printing will need to be deleted. In the case of the 4.1.9-1 PKGBUILD, 'other references' includes lines 169, 170 and 236:

    mkdir -p ${pkgdir}/usr/lib/cups/backend
    ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb
  install -d -m1777 ${pkgdir}/var/spool/samba