Whether you want to share files, printers or other services in your network – the Open Source software suite Samba is an incredible powerful tool which brings Linux, Windows and macOS client computers together. Samba can manage shares for users and groups, and since version 4, Samba can also take on the role of an Active Directory Domain Controller and thus replace the Windows directory service in a domain.File shares make data available in a central location – a real advantage, especially in large and heterogeneous environments with numerous computers and thousands of user accounts. Admins of a UCS or UCS@school domain can create shares in the Univention Management Console (UMC). Alternatively, the command line tool univention-directory-manager
manages shares on the shell.
On top that, you can use LDAP queries to automate thigns. The directory service can provide information about existing shares of a domain and, based on this information, automatically mount these shares. This also applies to applications which are not directly based on UCS.
In this article, I’ll demonstrate how to create Samba shares via the UMC and on the command line. I’ll also explain how to query the LDAP directory service to get detailed information about shares. Finally, I’ll show you how to use that information to automate things.
Table of Contents
UCS: OpenLDAP and Samba 4
If you manage Linux, Windows, and macOS clients in your UCS domain, you can use a second, AD-DS-compatible directory service in addition to the existing OpenLDAP: Samba 4. A blog post from May 2021 explains the differences between Samba and Active Directory and makes suggestions on how to combine the two solutions in your UCS domain. UCS synchronizes automatically between OpenLDAP (Linux and other Unix clients) and Samba 4 as an Active Directory compatible service. This way, both systems always have the same information.
As part of the UCS domain replication, shares can also be managed from a central point. This means that they are available on any computer in the UCS domain. The LDAP directory service handles the access rights for users, groups and everyone else (read, write, execute).
Samba’s main configuration file is /etc/samba/smb.conf. It defines, for example, which data the server shares with the users. Additionally, you’ll find several more configuration files in /etc/samba/shares.conf.d/ on your UCS machine. Those files are being created by a listener script which also takes care of the ACLs (Access Control List).
Creating Samba Shares in UMC
Using the module Domain / Shares in the Univention Management Console is an easy way to create shares for your domain: