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:

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 CIFS:

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

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