samba:samba_configuration
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
samba:samba_configuration [2016/07/10 22:01] – peter | samba:samba_configuration [2019/12/04 19:08] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Samba - Samba Configuration ====== | ||
- | |||
- | This example configuration will server out data from two directories. | ||
- | |||
- | The " | ||
- | |||
- | The " | ||
- | |||
- | |||
- | <file bash / | ||
- | # | ||
- | |||
- | [global] | ||
- | bind interfaces only = yes | ||
- | | ||
- | | ||
- | | ||
- | dns proxy = no | ||
- | | ||
- | | ||
- | guest ok = yes | ||
- | guest only = yes | ||
- | hosts allow = 10.10.10.0/ | ||
- | hosts deny = all | ||
- | | ||
- | | ||
- | load printers = no | ||
- | max connections = 10 | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | sync always = no | ||
- | | ||
- | | ||
- | | ||
- | |||
- | # | ||
- | |||
- | [incoming] | ||
- | create mask = 0400 | ||
- | directory mask = 0700 | ||
- | path = / | ||
- | writeable = yes | ||
- | |||
- | [archive] | ||
- | path = / | ||
- | writeable = no | ||
- | </ | ||
- | |||
- | |||
- | ===== Configuration options: step by step ===== | ||
- | |||
- | **bind interfaces only = yes** says that samba will only bind to the default ip of an interface. | ||
- | |||
- | **deadtime = 15** is the amount of minutes samba will consider an idle connection with a windows machine to be dead. | ||
- | |||
- | **default case = lower** means all file and directory names will be forced into lower case format. | ||
- | |||
- | **disable netbios = yes** we do not need netbios broadcasts for the windows shares so we can disable it. Our clients will be told where the share is located. | ||
- | |||
- | **dns proxy = no** is disabled. | ||
- | |||
- | **domain master = yes** means the samba server will take over as the " | ||
- | |||
- | **encrypt passwords = true** you will need to encrypt passwords to talk to windows 2000/ | ||
- | |||
- | **guest ok = yes** allow " | ||
- | |||
- | **guest only = yes** all machines accessing the shares will be guests. | ||
- | |||
- | **hosts allow = 10.10.10.0/ | ||
- | |||
- | **hosts deny = all** is to deny any host not listed in "hosts allow" | ||
- | |||
- | **interfaces = em1** says that we want to bind to the interface em1. Note: if we also used "bind interfaces only" then samba will bind to the primary ip on the em1 interface. | ||
- | |||
- | **invalid users = admin_user root** No windows share should ever try to log in with the names " | ||
- | |||
- | **load printers = no** in the example we do not have any printers, so we will disable this feature. | ||
- | |||
- | **max connections = 10** limits the amount of clients samba will allow access to, to no more than 10. | ||
- | |||
- | **netbios name = samba** is the name in the " | ||
- | |||
- | **preferred master = yes** says that the samba server will always win the vote for the master server on a windows network. | ||
- | |||
- | **preserve case = no** goes with " | ||
- | |||
- | printable = no goes with "load printers = no" as we do not have any printers on this server. | ||
- | |||
- | security = share is the security level of the windows shares. With share-level security, the server accepts only a password without an explicit username from the client. The server expects a password for each share, independent of the username. There have been recent reports that Microsoft Windows clients have compatibility issues with share-level security servers. Samba developers strongly discourage use of share-level security. | ||
- | |||
- | server string = Samba Share is the name windows clients will see. If the name of our server was "Samba Share (samba)" | ||
- | |||
- | socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536 are specifically speed up options for samba to windows connectivity. Socket options are controls on the networking layer of the operating systems which allow the connection to be tuned. This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We strongly suggest you read the appropriate documentation for your operating system first (perhaps man setsockopt will help). You may find that on some systems Samba will say " | ||
- | |||
- | strict syn = no and sync always = no are disabled to speed up samba. Strict syncing is normally used if you are paranoid about data lose in the transfer of files. We have never seen this problem in the real world. | ||
- | |||
- | syslog = 1 says we are going to log to the syslog fascility. | ||
- | |||
- | syslog only = yes means that only the syslog facility will be receiving logs from samba. | ||
- | |||
- | workgroup = WORKGROUP This controls what workgroup your server will appear to be in when queried by clients. Note that this parameter also controls the Domain name used with the security = domain setting. | ||
- | |||
- | Share Definitions | ||
- | |||
- | incoming: The masks are the creating permissions for new files and directories. The directive " | ||
- | |||
- | archive: The directive " | ||
- | |||
- | Starting the install | ||
- | |||
- | Step 1: Install samba from package or from source. For the example we are using the package from OpenBSD which is Samba v3.01. | ||
- | |||
- | Step 2: Place the smb.conf file from above into the /etc/samba/ directory named smb.conf . You should backup the default smb.conf file the package places there for future reference if you want to. | ||
- | |||
- | Step 3: Setup the directories we are going to share files from. The two directories " | ||
- | |||
- | achive: chmod 750 and chown admin_user: | ||
- | incoming: chmod 770 and chown admin_user: | ||
- | |||
- | This is what our example structure would look like. | ||
- | |||
- | admin_user@machine: | ||
- | drwxr-xr-x | ||
- | drwxr-xr-x | ||
- | drwxr-x--- | ||
- | drwxrwx--- | ||
- | |||
- | Executing the deamon | ||
- | |||
- | To start samba now that it is installed and the smb.conf from above is in place we can use the following lines. Two daemons actually make up the samba service, smbd and nmbd. You can execute the following lines by hand to start samba now. | ||
- | |||
- | / | ||
- | / | ||
- | |||
- | To start samba at boot, place the following in your / | ||
- | |||
- | # samba ( / | ||
- | if [ -x / | ||
- | echo -n ' samba' | ||
- | / | ||
- | / | ||
- | fi | ||
- | |||
- | Re-read the smb.conf after making any changes | ||
- | |||
- | After you make any modifications to the smb.conf file you will need to notify the smbd and nmbd daemons of the changes. To do this, you can restart Samba by manually killing smbd/nmbd and starting them again or send a HUP to smbd/nmbd. The HUP will tell both daemons to reread the config file without actually having to restart. Either option will work. | ||
- | |||
- | ## Option: manually kill and start on OpenBSD | ||
- | pkill smbd;pkill nmbd | ||
- | / | ||
- | / | ||
- | |||
- | ## Option: HUP on OpenBSD | ||
- | kill -HUP `cat / | ||
- | kill -HUP `cat / | ||
- | |||
- | Mounting a smbfs/cifs network export | ||
- | |||
- | To mount the samba partion to a linux or BSD box on the network you can use the following line. Place it in the /etc/fstab on the machine you want to mount from. | ||
- | |||
- | In this example we have two machines, samba_box which runs samba and another machine called BSD_box where we want to see the files from. This line will mount the directory / | ||
- | |||
- | ## /etc/fstab | ||
- | ## Samba mount (from BSD_box to samba_box) | ||
- | // | ||
- | |||
- | Questions? | ||
- | |||
- | How about optimizations and speed improvemnts for samba?Make sure to check out the calomel.org Samba Optimization and Speed Tuning. Many of the speed options are already in the example, but if you add more functionality make sure to check what to watch out for. There are options you could add that will slow samba significantly. | ||
- | |||
- | How can I log what files are accessed what is done with those files and by whom?You need to use at least samba-2.2.7a and use the audit.so module. The samba source code has what you need. Check out the information in ~samba/ | ||
samba/samba_configuration.1468188102.txt.gz · Last modified: 2020/07/15 09:30 (external edit)