Differences
This shows you the differences between two versions of the page.
— | samba [2019/01/28 17:47] (current) โ created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Samba ====== | ||
+ | * [[avahi]] | ||
+ | * [[findsmb]] | ||
+ | * [[nbtscan]] | ||
+ | * [[net]] | ||
+ | * [[pdbedit]] | ||
+ | * [[smbcontrol]] | ||
+ | * [[smbstatus]] | ||
+ | * [[testparm]] | ||
+ | |||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | === Users === | ||
+ | |||
+ | When creating a user in Samba through Webmin, it will default to no password. | ||
+ | |||
+ | You can setup User Synchronization in Webmin to create new Samba users as Unix ones are added, and more. | ||
+ | |||
+ | === smbd === | ||
+ | |||
+ | The smbd program provides file and printer network sharing, and includes the password authentication service for users. | ||
+ | |||
+ | smbd will listen on port 445 for SMB or CIFS protocol traffic. | ||
+ | |||
+ | == smbd configuration file == | ||
+ | |||
+ | The configuration file is scanned for changes every three minutes. | ||
+ | |||
+ | You can reload the file manually if you like: | ||
+ | |||
+ | < | ||
+ | smbcontrol smbd reload-config | ||
+ | </ | ||
+ | |||
+ | == Display build options == | ||
+ | |||
+ | < | ||
+ | smbd -b | ||
+ | </ | ||
+ | ==== nmbd ==== | ||
+ | |||
+ | nmbd provides NetBIOS name service and browsing. | ||
+ | |||
+ | Disabling nmbd will cause OS X to not display the server in Finder' | ||
+ | |||
+ | Gentoo by default will run both smbd and nmbd. You only need smbd, and can change the services in ''/ | ||
+ | |||
+ | ==== Firewall ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | ==== OS X ==== | ||
+ | |||
+ | == Finder Bugs == | ||
+ | |||
+ | Finder has a large number of bugs related to Samba: | ||
+ | |||
+ | * Guest access to shares does not work | ||
+ | * Ejecting a share when only one share from the server is connected, the Shared server list will disconnect, but the shared list will still continue to show the eject button | ||
+ | * If it cannot connect to a share because of user permissions, | ||
+ | * When disconnecting from the server, it will automatically try to reconnect and fail | ||
+ | * Selecting the server from the Shared menu will take a long time and then fail if there is not a default share set in Samba | ||
+ | * Finder will sometime cache the mDNS entry for the Samba service, and will not disappear even if avahi is stopped, or if Samba is stopped. | ||
+ | |||
+ | The best way to setup Samba for finder is have a default share that users log into, and / or to allow guests to view the shares. | ||
+ | |||
+ | == Connect as username == | ||
+ | |||
+ | When connecting to a Samba share, you cannot use the long name "User Account" | ||
+ | |||
+ | == Debug OS X == | ||
+ | |||
+ | You can debug OS X's behavior by opening the Console app in the Utilities folder. | ||
+ | |||
+ | ==== Configuration ==== | ||
+ | |||
+ | Setting up Samba' | ||
+ | |||
+ | For this setup, I'm using Gentoo Linux and the latest Samba 3.x security release, 3.6.23. | ||
+ | |||
+ | Before starting, there is one thing to keep in mind -- Samba' | ||
+ | |||
+ | Use testparm to display current configuration, | ||
+ | |||
+ | < | ||
+ | testparm -s | ||
+ | </ | ||
+ | |||
+ | ** For the record: ** You can display the __full__ configuration directives that Samba is using by running '' | ||
+ | |||
+ | Okay, to start with, let's do a barebones, completely empty configuration file. | ||
+ | |||
+ | < | ||
+ | touch / | ||
+ | </ | ||
+ | |||
+ | Use '' | ||
+ | |||
+ | < | ||
+ | [global] | ||
+ | idmap config * : backend = tdb | ||
+ | </ | ||
+ | |||
+ | For the next step, let's set up guest access. | ||
+ | |||
+ | Samba maps local usernames on the server to Samba user names with the ''/ | ||
+ | |||
+ | < | ||
+ | root = Administrator admin | ||
+ | nobody = guest pcguest smbguest | ||
+ | </ | ||
+ | |||
+ | Users '' | ||
+ | |||
+ | < | ||
+ | uid=65534(nobody) gid=65534(nobody) groups=65534(nobody) | ||
+ | </ | ||
+ | |||
+ | Next, configure Samba to map users who log in as guests, or users who attempt to access the server with no usernames. | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The wording can seem a bit confusing, so to clarify, if a user tries to log in with a non-existent account on the server, Samba drops the login to a guest account. | ||
+ | |||
+ | This configuration **is required** to enable guest access using OS X. In my experience, Linux clients work fine without it. | ||
+ | |||
+ | Add the configuration directive to the '' | ||
+ | |||
+ | < | ||
+ | [global] | ||
+ | map to guest = Bad User | ||
+ | idmap config * : backend = tdb | ||
+ | </ | ||
+ | |||
+ | Based on your client, you may or may not be able to connect to the Samba server. | ||
+ | |||
+ | Now, let's create a sample share with guest access, so that we can start connecting and verifying access. | ||
+ | |||
+ | For this example, we'll use the system' | ||
+ | |||
+ | < | ||
+ | [tmp] | ||
+ | path = /tmp | ||
+ | </ | ||
+ | |||
+ | Restart Samba, and try connecting with your client. | ||
+ | |||
+ | ** There' | ||
+ | |||
+ | To fix guest access, specifically enable guest access in the share. | ||
+ | |||
+ | < | ||
+ | [global] | ||
+ | map to guest = Bad User | ||
+ | idmap config * : backend = tdb | ||
+ | |||
+ | [tmp] | ||
+ | path = /tmp | ||
+ | guest ok = Yes | ||
+ | </ | ||
+ | |||
+ | Restart Samba, and re-connect with Finder, and it will successfully connect as guest and display the share now. | ||
+ | |||
+ | Now, the next step is to let the user write to the file share. | ||
+ | |||
+ | < | ||
+ | read only = No | ||
+ | </ | ||
+ | |||
+ | Here's the updated '' | ||
+ | |||
+ | < | ||
+ | [global] | ||
+ | map to guest = Bad User | ||
+ | idmap config * : backend = tdb | ||
+ | |||
+ | [tmp] | ||
+ | path = /tmp | ||
+ | read only = No | ||
+ | guest ok = Yes | ||
+ | </ | ||
+ | |||
+ | Connect as the client, and make some changes to the share. | ||
+ | |||
+ | I'm going to use Finder to create a new folder, and use it's default name of '' | ||
+ | |||
+ | Look at the files or folders created on the filesystem, and you will see that they are created by user '' | ||
+ | |||
+ | < | ||
+ | # stat / | ||
+ | File: โ/ | ||
+ | Size: 4096 Blocks: 8 IO Block: 4096 | ||
+ | Device: 803h/ | ||
+ | Access: (0755/ | ||
+ | Access: 2014-04-03 21: | ||
+ | Modify: 2014-04-03 21: | ||
+ | Change: 2014-04-03 21: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # Samba configuration | ||
+ | # | ||
+ | # * Guest access for OS X | ||
+ | # * Require NT1 protocol support, allow newer SMB2 support | ||
+ | # * User security level (default) | ||
+ | # * Default to ' | ||
+ | # * and more .. | ||
+ | # See https:// | ||
+ | |||
+ | [global] | ||
+ | # Needed to allow Guest access for OS X and connecting to the server | ||
+ | # without needing to connect to an actual share. | ||
+ | map to guest = Bad User | ||
+ | # likewise, have a default share so that when connecting, it can have | ||
+ | # somewhere to go | ||
+ | default service = images | ||
+ | |||
+ | # SMB2 is native to OS X, but there have been reports that it is slow. | ||
+ | # All the reports I've found online were back in late 2013, and since | ||
+ | # Mavericks has had a lot of updates since then (April 2014 at time of | ||
+ | # writing), I'm enabling it. | ||
+ | # http:// | ||
+ | # max protocol = SMB2 | ||
+ | max protocol = SMB2 | ||
+ | # The default minimum protocol is CORE, which is really old. NT1 is | ||
+ | # the same as SMB1. | ||
+ | min protocol = NT1 | ||
+ | |||
+ | # Enabling keepalives as a preliminary precaution. | ||
+ | # it is not necessary *IF* socket options have SO_KEEPALIVE attirbute | ||
+ | # enabled, which it does not. | ||
+ | # The default socket options are " | ||
+ | # http:// | ||
+ | # http:// | ||
+ | keepalive = 600 | ||
+ | log level = 0 auth:3 | ||
+ | |||
+ | # Disabling printer support | ||
+ | load printers = no | ||
+ | |||
+ | # Cosmetics | ||
+ | comment = nas | ||
+ | |||
+ | # Possibly relevant if debugging | ||
+ | # http:// | ||
+ | # deadtime = 15 | ||
+ | |||
+ | # Disable old NETBIOS support | ||
+ | disable netbios = yes | ||
+ | |||
+ | # Keep a log for each individual | ||
+ | # log file = / | ||
+ | |||
+ | # Map usernames (for guest accounts) | ||
+ | # This could also be useful for ' | ||
+ | username map = / | ||
+ | | ||
+ | [software] | ||
+ | path = / | ||
+ | read only = No | ||
+ | guest ok = Yes | ||
+ | |||
+ | comment = Software for all OSes | ||
+ | |||
+ | [images] | ||
+ | path = / | ||
+ | guest only = Yes | ||
+ | guest ok = Yes | ||
+ | |||
+ | comment = OS X VirtualBox Images | ||
+ | |||
+ | [public] | ||
+ | path = / | ||
+ | |||
+ | [private] | ||
+ | path = / | ||
+ | |||
+ | [testing] | ||
+ | path = / | ||
+ | read only = No | ||
+ | guest ok = No | ||
+ | comment = Testing Samba EA | ||
+ | ea support = yes | ||
+ | force create mode = 0644 | ||
+ | force directory mode = 0755 | ||
+ | </ |