Flesh out the Samba HOWTO a bit (#135)

* Initial commit of skeleton Samba help-center documentation (#118).

* Basic examples added.

* Update lastmod.

* Kill TOML aliases statement.

* Include changes requested in review.

* Fix capitalized Samba -> samba man page name.

* Fix a few typos, add notes on caja-share for MATE

* Small fixes.

* Update header

* Explain how the default Solus configuration works + small fixes.

* Fix Budgie typo.

* Update lastmod.

* Update per PR review.

* Remember to update lastupdate field in header.
This commit is contained in:
Rune Morling 2018-04-27 14:16:17 +02:00 committed by Joshua Strobl
parent cb79b6860b
commit 0eaec03f03
1 changed files with 24 additions and 16 deletions

View File

@ -1,6 +1,6 @@
+++
title = "Samba File Sharing"
lastmod = "2018-04-20T15:34:16+03:00"
lastmod = "2018-04-24T18:58:00+02:00"
+++
# Samba file sharing
@ -14,18 +14,20 @@ To enable convenient file-sharing on Solus, we maintain a Solus-specific Samba c
In order to support user-managed (as opposed to system-managed) shares, Samba provides the so-called *usershare* functionality, where users can define network shares without touching the traditional Samba configuration file.
### GUI - configuring shares via nautilus-share
### GUI - configuring shares via file manager plugins
The default Solus configuration was written with the `nautilus-share` file manager plugin in mind. This plugin allows the user to share folders in an easy and convenient way.
The default Solus configuration was written with the `nautilus-share` (Budgie/GNOME) and `caja-share` (MATE) file manager plugins in mind. These plugins allows the user to share folders in an easy and convenient way.
All the user needs to do is to install the `nautilus-share` package from the Software Center and enable the relevant Samba services.
All the user needs to do is to install either the `caja-extensions` package (which includes the `caja-share` plugin) or the `nautilus-share` package from the Software Center and enable the relevant Samba services.
``` bash
sudo eopkg install nautilus-share
sudo systemctl enable --now smb
```
In order for the nautilus-share plugin to be loaded, the user will need to log out of the current desktop session and log back in to a new desktop session, at which point the nautilus-share plugin will be loaded and ready for use.
In order to load the newly installed file manager plugin, the user will need to log out of the current desktop session and log back in to a new desktop session, at which point the plugin in question will be ready for use.
Simply right-clicking a folder will now show an option to share it.
### CLI - using the net usershare command
@ -45,30 +47,36 @@ net usershare info wildcard-sharename
To print information about user defined shares.
```
## Adding system shares via /etc/samba/smb.conf
## Adding custom configuration parameters via `/etc/samba/smb.conf`
The default Solus-managed configuration is written such that it will attempt to include any configuration directives present in `/etc/samba/smb.conf`.
**CAUTION:** *From this point on, it is assumed that the user is familiar with the Samba documentation, including `man smb.conf`, and that the user has a basic understanding of Linux filesystem permissions.*
By default, the Solus-managed configuration enables $HOME shares and is configured to participate in the WORKGROUP windows workgroup.
The default Solus-managed configuration (which lives in `/usr/share/defaults/samba/smb.conf` and will be overwritten on each samba package update) is written such that it will attempt to include any configuration parameters present in `/etc/samba/smb.conf`.
**CAUTION:** *From this point on, it is assumed that the user is familiar with the Samba documentation, including `man smb.conf` and that the user has a basic understanding of Linux filesystem permissions.*
Hence, any persistent user-managed parameters should be added to `/etc/samba/smb.conf` which will *never* be overwritten by the system package manager.
### Example -- anonymous, read-write share outside of $HOME
In addition, the Solus-controlled Samba configuration is written such that it is possible to override its default parameters simply by assigning a new value to the parameter in question in `/etc/samba/smb.conf`. From a technical perspective, any parameters added without a `[shared resource]` header will considered part of the `[global]` configuration section.
This way, it becomes possible to reset Samba to Solus working defaults simply by deleting or renaming `/etc/samba/smb.conf`.
By default, the Solus-managed configuration enables *$HOME* shares (`[homes]` section) and is configured to participate in the WORKGROUP Windows workgroup.
### Example -- anonymous, read-write share outside of *$HOME*
``` ini
# Contents of /etc/samba/smb.conf
# if ^^ exists, it is automatically loaded by the Solus-controlled default config
# residing in /usr/share/defaults/smb.conf
# residing in /usr/share/defaults/samba/smb.conf
#
# Create a "//servername/someshare" share where anonymous users have read and write access
#
# ';' denotes a comment, which is typically used for config statements
[other]
# ';' also denotes a comment (typically used for configuration parameters)
[someshare]
path = /mnt/someshare
# allow anonymous access
guest ok = Yes
# ONLY allow anonymous access (don't allow both guest and system user access)
;guest only = Yes
guest only = Yes
# allow write access
read only = No
# This is an example of how to limit access to the share to known IPs
@ -77,13 +85,13 @@ read only = No
# share config end
```
After adding a system-managed share like in the above example, run `sudo testparm` to check that the newly included share does not contain syntax errors. Check out `man testparm` for more information about the `testparm` utility.
After adding a `[someshare]` section like in the above example, run `sudo testparm` to check that the newly included share does not contain syntax errors. Check out `man testparm` for more information about the `testparm` utility.
In the above case, it is assumed that the user has chosen a suitable method for making `/mnt/someshare` writeable by guest users.
## Full manual control of Samba (recommended only for experienced Samba admins)
Full manual control of Samba can be achieved by bypassing the default Solus Samba configuration.
Full manual control of Samba can be achieved by completely bypassing the default Solus Samba configuration.
In the Samba manual page (`man 8 samba`), it is shown how the compiled-in default config file can be overridden by specifying the `--configfile=<somepath>` flag during invocation of Samba.