Samba

Samba is a re-implementation of the SMB/CIFS networking protocol, a Microsoft Windows alternative to Network File System (NFS).

Kernel
Activate the following kernel options:

Optional: Make sure to enable the filesystems you want to mount later on

Emerge
Emerge Samba:

Samba can also be installed by setting the global USE flag  and updating the system:

USE flags
If the full Samba package is not needed, the package is available:

Emerge
Emerge the CIFS user-space tools:

OpenRC
When using OpenRC, adding Samba to the default runlevel will enable the Samba service to start when the system boots:

To start the Samba service now issue:

Systemd
For systemd users, the Samba service can be configuired to start during boot using :

To start the service immediately issue:

Mount the shared content
Once the client is fully configured, the shares can soon be accessed.

Create the mount point:

Mount the exported folders:

To automatically mount shares on every boot, edit /etc/fstab to look like this:

Troubleshooting
Some problems may occur when trying to mount new CIFS shares. The following sections attempt to provide resolutions to common problems.

Cannot resolve 
More specifically, the actual error:

This can easily be fixed by editing and appending   next to the   entry:

If this does not work, use the NFS server's IP address instead of the O2-Foobar hostname. The nmblookup utility (provided by ) comes in handy when trying to find the IP address of an NFS host:

Shutdown process hangs when trying to unmount CIFS shares
If the system shutdown hangs at then users must make sure the CIFS shares are unmounted properly before udev tries to stop. One way to work around this is to create local.d scripts to unmount the CIFS filesystems:

Windows asking for passwords
security = share

When you can't start samba and get this errors ( in my case after upgrade from samba-4.2.9 to samba-4.2.11) :

../lib/param/loadparm.c:1082(lp_set_enum_parm) WARNING: Ignoring invalid value 'share' for parameter 'security' ../source3/smbd/server.c:1256(main) error opening config file '/etc/samba/smb.conf'

Change global security to:

security = user

To keep windows users access without username/password:

map to guest = bad user

Emerge wants to downgrade to Samba 3 because of FFmpeg dependency
This is probably caused by enabling  on, which isn't supported on Samba 4. Since Samba support is rarely needed by (in the typical use case, the media player itself handles media files served over smb), the   USE flag can be disabled for  without losing essential functionality.

External resources

 * Practical Exercises in Successful Samba Deployment
 * Samba Howto Collection
 * Samba GUI