Differences

This shows you the differences between two versions of the page.

doc:uci:samba [2013/02/19 04:29]
hcc23 Added a note on the necessity for matching permissions.
doc:uci:samba [2014/03/13 14:25] (current)
fidelio Add listening interface option.
Line 2: Line 2:
For installation instructions see [[doc:howto:cifs.server|Samba How To]] For installation instructions see [[doc:howto:cifs.server|Samba How To]]
 +=====UCI configuration options=====
 +The UCI configuration file is located at /etc/config/samba. Be extremely careful editing this file by hand - the samba shell interface (/etc/init.d/samba restart) will ignore invalid options, but LuCI Services/Network Shares will bring up an error like this:
 +<code>/usr/lib/lua/luci/dispatcher.lua:449: Failed to execute cbi dispatcher target for entry '/admin/services/samba'.
 +</code>
- +It is hence strongly recommended that you use LuCI to establish the initial configuration and then edit the template file (/etc/samba/smb.conf.template) via LuCI Edit Template tab or from the shell as needed.
- +
- +
- +
- +
- +
- +
- +
-=====UCI configuration options===== +
-The UCI configuration file is located at /etc/config/samba+
==== Common Options ==== ==== Common Options ====
-The config section type ''samba'' determines values and options relevant to the overall operation of samba. The following table lists some (not all) available options, their default value and respectively a short characterization. See [[http://***]] for further details.+The config section type ''samba'' determines values and options relevant to the overall operation of samba. The following table lists all available options, their default value and respectively a short characterization. See [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#idp58030944|smb.conf man page]] for further details.
These are the default settings for the common options: These are the default settings for the common options:
<code>config 'samba' <code>config 'samba'
-        option 'name' 'openwrt+        option 'name' 'OpenWrt
-        option 'workgroup' 'openwrt+        option 'workgroup' 'OpenWrt
-        option 'description' 'openwrt'+        option 'description' 'Samba on OpenWrt' 
 +        option 'charset' 'UTF-8' 
 +        option 'homes' '0'
</code> </code>
<sortable> <sortable>
^ Name ^ Type ^ Required ^ Default ^ Option ^ Description ^ ^ Name ^ Type ^ Required ^ Default ^ Option ^ Description ^
-| ''name'' | string | yes? | openwrt |         | Name of the Server  | +| ''name'' | string | no | hostname or OpenWrt | | Name of the Server  | 
-| ''workgroup'' | string | yes? | openwrt |   | Name of the Workgroup | +| ''workgroup'' | string | no | hostname or OpenWrt | | Name of the Workgroup | 
-| ''description'' | string | yes? | openwrt |  | Description of the Server | +| ''description'' | string | no | Samba on hostname or OpenWrt |  | Description of the Server
-| ''homes'' | boolean | yes? | 1 |            | Share the user directory |+| ''charset'' | string | no | UTF-8 |  | Display charset & unix charset
 +| ''homes'' | boolean | no | 0 | 0, 1 | Share the user directory
 +| ''interface'' | string | no | loopback lan |  | Interfaces samba should listen on. Syntax: "<uci-interface-name> <uci-interface-name> ...". Note, that it is __not__ of type list. |
</sortable> </sortable>
- 
==== Sambashare ==== ==== Sambashare ====
Line 50: Line 48:
^ Name ^ Type ^ Required ^ Default ^ Option ^ Description ^ ^ Name ^ Type ^ Required ^ Default ^ Option ^ Description ^
| ''name'' | string | yes | //(none)// |  | Name of the entry. Will be shown in the filebrowser. | | ''name'' | string | yes | //(none)// |  | Name of the entry. Will be shown in the filebrowser. |
-| ''path'' | file path | yes | //(none)// | | The complete path of the directory | +| ''path'' | file path | yes | //(none)// | | The complete path of the directory. [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#PATH|path]]
-| ''users'' | string | no | //(none)// | | the samba-users allowed access to this entry; use ''smbpasswd'' to create a user-pwd combination! Several users can be specified, separated by a coma (ex : option 'users' 'root,nobody' ). | +| ''users'' | string | no | guest account or from global template | | the samba-users allowed access to this entry; use ''smbpasswd'' to create a user-pwd combination! Several users can be specified, separated by a coma (ex : option 'users' 'root,nobody' ). Translated to [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#VALIDUSERS|valid users]]. | 
-| ''guest_ok'' | string | yes | ''no'' | | Specifies if you need to login via samba-username and password to access this share | +| ''read_only'' | string | no | yes or from global template | no, yes | no allows for read/write, else only read access is granted; (for rw, you also need to mount fs rw!). [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#READONLY|read only]]. | 
-| ''create_mask'' | integer | yes | ''0700'' | | chmod mask for files created (need write access) | +| ''guest_ok'' | string | no | no or from global template | no, yes | Specifies if you need to login via samba-username and password to access this share. [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#GUESTOK|guest ok]].
-| ''dir_mask'' | integer | yes | ''0700'' | | chmod mask for directories created (need write access) +| ''create_mask'' | integer | no | 0744 or from global template | | chmod mask for files created (need write access). [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#CREATEMASK|create mask]]
-| ''read_only'' | boolean | yes | ''no'' | | no allows for read/write, else only read access is granted; (for rw, you also need to mount fs rw!) |+| ''dir_mask'' | integer | no | 0755 or from global template | | chmod mask for directories created (need write access). [[http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#DIRECTORYMASK|directory mask]]. |
|  | | | | |  | |  | | | | |  |
</sortable> </sortable>
Line 62: Line 60:
===== Additional Configuration Options ===== ===== Additional Configuration Options =====
 +==== Common Options ====
 +In addition to the UCI file (''/etc/config/samba''), modifications can be made to the ''/etc/samba/smb.conf.template'' file.
 +==== Sambashare ====
 +Modifications can be made to the ''/etc/samba/smb.conf.template'' file, based on ''/var/etc/smb.conf'' file, created by ''/etc/init.d/samba''.
 +The full section from ''/var/etc/smb.conf'' should be added to ''/etc/samba/smb.conf.template'' and removed from UCI.
-In addition to the UCI file (''/etc/config/samba''), modifications can be made to the /etc/samba/smb.conf.template file.+For example:<code bash>uci show samba | grep name 
 +samba.@sambashare[0].name=over9000 
 +sed -e '/\[over9000\]/,/^$/ !d' /var/etc/smb.conf >> /etc/samba/smb.conf.template 
 +uci delete samba.@sambashare[0] 
 +uci commit samba 
 +/etc/init.d/samba restart</code> 
 + 
 +In a second approach ''/etc/init.d/samba'' could also be edited for spit whatever to ''/var/etc/smb.conf'' associated with UCI. 
 + 
 +For example, hack once:<code bash>sed -i -e '/dir_mask/p;s/dir_mask\|directory mask/browsable/g' /etc/init.d/samba</code> 
 +Then, anytime:<code bash>uci show samba | grep name 
 +samba.@sambashare[0].name=over9000 
 +uci set samba.@sambashare[0].browsable=no 
 +uci commit samba 
 +/etc/init.d/samba restart 
 +cat /var/etc/smb.conf</code>
===== Configuration examples ===== ===== Configuration examples =====
Line 95: Line 113:
<code>config 'samba' <code>config 'samba'
option 'name' 'openwrt' option 'name' 'openwrt'
- option 'description' 'openwrt' 
option 'workgroup' 'WORKGROUP' option 'workgroup' 'WORKGROUP'
 + option 'description' 'openwrt'
 + option 'homes' '1'
config 'sambashare' config 'sambashare'
Line 123: Line 142:
=== 2. Add samba password to user === === 2. Add samba password to user ===
-''smbpasswd newuser password''+''smbpasswd -a newuser''
=== 3. Change samba config to accept users with null passwords === === 3. Change samba config to accept users with null passwords ===
Edit ''/etc/samba/smb.conf.template'' and add ''null passwords = yes'': Edit ''/etc/samba/smb.conf.template'' and add ''null passwords = yes'':
Line 149: Line 168:
<code>config 'samba' <code>config 'samba'
option 'name' 'openwrt' option 'name' 'openwrt'
- option 'description' 'openwrt' 
option 'workgroup' 'WORKGROUP' option 'workgroup' 'WORKGROUP'
 + option 'description' 'openwrt'
 + option 'homes' '1'
config 'sambashare' config 'sambashare'
Line 161: Line 181:
This share should now be accessible by ''\\ip-adress-openwrt\name-of-share'' (windows, correct username and password are needed). This share should now be accessible by ''\\ip-adress-openwrt\name-of-share'' (windows, correct username and password are needed).
- 
Line 175: Line 194:
More information about this issue here: https://dev.openwrt.org/ticket/9992 More information about this issue here: https://dev.openwrt.org/ticket/9992
 +
 +
 +If your CPU is your samba bottleneck, disabling sendfile might help.
 +See http://www.linksysinfo.org/index.php?threads/speeding-up-the-samba-by-30.52240/
 +

Back to top

doc/uci/samba.1361244556.txt.bz2 · Last modified: 2013/02/19 04:29 by hcc23