Skip to content

presire/SambaConfig

Repository files navigation

SambaConfig

A GUI-based Samba configuration tool for Linux, built with Qt 6 (QML) / C++17.
An alternative to the discontinued system-config-samba.

Overview

SambaConfig allows you to visually edit smb.conf, manage Samba users,
validate configuration with testparm, control smbd/nmbd services via systemd,
and manage firewalld ports - all from a single GUI application.

Key Features

  • Edit smb.conf - Read, edit, and save Samba configuration files with a graphical editor
  • Validate configuration - Run testparm to check smb.conf syntax directly from the GUI
  • Manage Samba users - Create and delete Samba users via smbpasswd / pdbedit
  • systemd integration - Start, stop, and check the status of smbd / nmbd services
  • firewalld integration - Open and close ports (SMB, NetBIOS, LDAP, Kerberos, DNS, etc.)
  • Internationalization - English and Japanese
  • Dark / Light theme - Material Dark theme by default, switchable to Light theme
  • Adjustable font size - Three levels (small, normal, large)

Architecture

SambaConfigApp (GUI, QML/C++)
  |
  |--[D-Bus]--> SambaConfigHelper (runs as root)
  |                 Uses PolKit for authentication
  |                 Reads/writes smb.conf
  |                 Executes testparm, smbpasswd, pdbedit
  |                 Queries remote Samba servers (libsmbclient)
  |
  |--[link]---> libSambaConfigUtility.so (shared library)
  |                 File permission checks
  |                 Process execution utilities
  |                 User/group information queries
  |
  |--[D-Bus]--> org.freedesktop.systemd1 (systemd)
  |--[D-Bus]--> org.fedoraproject.FirewallD1 (firewalld)

SambaConfigApp runs as a normal user. Operations that require root privileges (reading/writing smb.conf, managing users, etc.) are delegated to SambaConfigHelper via D-Bus, with PolKit authentication.

Directory Structure

SambaConfigProject/
├── SambaConfigApp/             # Main GUI application
│   ├── Source/                 # C++ backend
│   │   ├── ApplicationState    # App settings & state management
│   │   ├── SambaConfigReader   # smb.conf parser
│   │   ├── SambaConfigWriter   # smb.conf writer
│   │   ├── SambaService        # systemd service control
│   │   ├── Testparm            # testparm execution
│   │   ├── SambaUserManager    # Samba user management
│   │   ├── SambaUsersModel     # User list model
│   │   ├── FirewalldManager    # firewalld management
│   │   ├── SambaModel          # Share section model
│   │   ├── PDBEdit             # pdbedit utility
│   │   ├── ValidUserManager    # User validation
│   │   ├── FileDialogHelper    # Native file dialog
│   │   ├── FileSelectDialog    # File selection helper
│   │   └── main.cpp
│   ├── ScreenQML/              # Screen QML files (14 files)
│   │   ├── Main.qml            # Main window & navigation
│   │   ├── WelcomeSambaConfig  # Welcome screen
│   │   ├── SambaConfig         # Samba config list
│   │   ├── SambaConfigMain     # Config editor main
│   │   ├── EditShareWindow     # Share edit dialog
│   │   ├── EditShareTab*       # Edit tabs (Basic/Advanced/Access/Global)
│   │   ├── SambaTest           # testparm execution
│   │   ├── SambaUserSettings   # User management
│   │   ├── Firewalld           # Firewalld management
│   │   ├── ModeSettings        # App settings
│   │   └── AboutQt             # About Qt screen
│   ├── CustomQML/              # Custom dialogs (14 files)
│   │   ├── AddUserDialog       # Add user
│   │   ├── ChangePasswordDialog # Change password
│   │   ├── DeleteUserDialog    # Delete user
│   │   ├── FileSelectDialog    # File selection
│   │   ├── FolderSelectDialog  # Folder selection
│   │   ├── ErrorDialog/Popup   # Error display
│   │   ├── CompletePopup       # Success notification
│   │   ├── PasswordDialog      # Password input
│   │   ├── SaveDialog          # Save confirmation
│   │   ├── QuitDialog          # Quit confirmation
│   │   ├── RestartDialog       # Restart confirmation
│   │   ├── WarningDialog       # Warning display
│   │   └── SSHOptionListView   # SSH options
│   ├── JavaScript/             # JS utilities
│   │   ├── ScreenHistory.js    # Screen navigation history
│   │   └── ScreenStates.js     # Screen state constants
│   ├── Image/                  # Icon images
│   ├── i18n/                   # Translation files (.ts)
│   ├── qtquickcontrols2.conf   # Theme configuration
│   └── CMakeLists.txt
├── SambaConfigHelper/          # D-Bus helper (runs as root)
│   ├── SambaConfigHelper       # Main helper implementation
│   ├── SambaConfigAdaptor      # D-Bus adaptor (auto-generated)
│   ├── AuthCallback            # libsmbclient auth callback
│   ├── PDB                     # Passdb access
│   ├── dbus/                   # D-Bus XML interface definition
│   ├── cmake/                  # CMake modules
│   ├── SMB/                    # Samba library headers
│   ├── i18n/                   # Translation files
│   └── CMakeLists.txt
├── SambaConfigUtility/         # Shared library (libSambaConfigUtility.so)
│   ├── SambaConfigUtility      # Utility implementation
│   ├── i18n/                   # Translation files
│   └── CMakeLists.txt
├── D-Bus/                      # D-Bus config templates (.conf.in, .service.in)
├── Polkit/                     # Polkit policy (.policy.in)
├── SELinux/                    # SELinux policy (.te, .fc, .if)
├── DeskopEntry/                # Desktop entry (.desktop.in)
├── Scripts/                    # Wrapper script (.sh.in)
├── HC/                         # Screenshot images
├── ThirdPartyLicenses/         # Third-party licenses
├── packaging/                  # Packaging (debian/, rpm/)
└── CMakeLists.txt              # Top-level build configuration

Requirements

Supported Platforms

  • SUSE Linux Enterprise / openSUSE Leap
  • Debian 13 Trixie
  • Other Linux distributions with the required dependencies

Dependencies

Dependency Components Notes
Qt 6.2+ Core, DBus, Gui, Widgets, Quick, QuickControls2, Concurrent, Xml, LinguistTools qt.io (LGPL)
PolkitQt6-1 Core, Agent PolkitQt-1 (LGPL)
Polkit - Polkit (LGPL)
libsmbclient - Samba client library
pkg-config - Library detection at build time
CMake 3.21+ - Build system
C++17 compiler - GCC 10+ / Clang 12+

Optional Dependencies

Dependency Purpose
selinux-policy-devel policycoreutils (SUSE) Build SELinux policy module (-DENABLE_SELINUX=ON)

Package Installation Examples

SUSE Linux Enterprise / openSUSE Leap

sudo zypper install \
    qt6-core-devel qt6-dbus-devel qt6-gui-devel qt6-widgets-devel \
    qt6-quick-devel qt6-quickcontrols2-devel qt6-concurrent-devel \
    qt6-xml-devel qt6-linguist-devel \
    polkit-devel libpolkit-qt6-1-devel samba-devel \
    cmake gcc-c++ pkg-config

Debian 13 Trixie

sudo apt install \
    qt6-base-dev qt6-declarative-dev qt6-tools-dev qt6-tools-dev-tools \
    libpolkit-qt6-1-dev libpolkit-gobject-1-dev \
    libsmbclient-dev samba-client \
    cmake g++ pkg-config

Note:
You need to build it from source: https://invent.kde.org/libraries/polkitqt-1

If Qt 6 or libsmbclient in your distribution is too old, you can also build them from source and specify paths with -DWITH_POLQT_DIR and -DWITH_SMB_DIR options.

Build

Debug Build

cmake -B Debug -S . -DCMAKE_BUILD_TYPE=Debug
cmake --build Debug

Release Build

cmake -B Release -S . -DCMAKE_BUILD_TYPE=Release
cmake --build Release

Build Options

Option Default Description
ENABLE_SELINUX OFF Build and install SELinux policy module
ENABLE_WRAPPER_SCRIPT OFF Install SambaConfig.sh wrapper script
WITH_POLQT_DIR (auto) PolkitQt6 installation directory
WITH_SMB_DIR (auto) smbclient library directory

Example with all options:

cmake -B Release -S . \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_SELINUX=ON \
    -DENABLE_WRAPPER_SCRIPT=ON \
    -DWITH_POLQT_DIR=/usr/lib64/cmake/PolkitQt6-1

Install

sudo cmake --install Release --prefix /usr/local

This installs:

Component Path
GUI application /usr/bin/SambaConfig
Wrapper script /usr/bin/SambaConfig.sh
D-Bus helper /usr/libexec/SambaConfigHelper
Shared library /usr/lib64/libSambaConfigUtility.so
D-Bus config /usr/share/dbus-1/system.d/org.presire.sambaconfig.conf
D-Bus service /usr/share/dbus-1/system-services/org.presire.sambaconfig.service
PolKit policy /usr/share/polkit-1/actions/org.presire.sambaconfig.policy
Desktop entry /usr/share/applications/SambaConfig.desktop
Icon /usr/share/icons/hicolor/128x128/apps/SambaConfig.png

SELinux Policy (Optional)

If built with -DENABLE_SELINUX=ON:

# Load the policy module
sudo semodule -i /usr/share/selinux/packages/sambaconfig.pp

# Apply file contexts
sudo restorecon -Rv /usr/bin/SambaConfig*
sudo restorecon -Rv /usr/libexec/SambaConfigHelper
sudo restorecon -Rv /usr/lib64/libSambaConfigUtility*

Usage

Launch

From the desktop menu, or from the command line:

SambaConfig

または

SambaConfig.sh

Note:
A warning dialog is displayed if the application is launched as root.
It is recommended to run as a normal user - root operations are handled via D-Bus/PolKit.

Keyboard Shortcuts

Key Action
Ctrl+Q Quit application
Shift+Esc / Home Return to home screen
Mouse Back / Forward Navigate between screens
Ctrl+PgUp / Ctrl+PgDn Switch tabs in share edit dialog
Alt+L Load firewalld zones
Alt+R Load smb.conf / Reset settings
Alt+W Write smb.conf
Alt+C Execute testparm / Cancel
Alt+A Apply (save) share settings
Alt+S Save settings

Edit Samba Configuration

Click the [Samba] button on the main screen.

  1. Select the path to smb.conf and click [Load]
  2. Sections ([global], [homes], user-defined shares) are displayed in a list
  3. Double-click a section to open its configuration editor
Before Loading File Selection
After Loading

Section Settings

[global] section:

  • Share name
  • User and group access privileges

User-defined sections:

  • Directory path
  • Share name
  • Read / write permissions
  • Visibility
  • Description
  • User and group access privileges
[global] Basic Settings [users] Basic Settings
[users] Advanced Settings

Advanced settings (user-defined sections):

  • File/directory permissions: create mask, directory mask, force create mode, force directory mode
  • Inheritance: inherit acls, inherit permissions, inherit owner
  • Access restrictions: hosts allow, hosts deny, write list, read list, admin users, invalid users
  • Guest access: guest ok, guest only
  • File handling: veto files, hide dot files, store dos attributes, follow symlinks, wide links
  • Other: force user, force group, vfs objects, oplocks, access based share enum

Access Control Settings

You can configure access control per section:

  • Allow all users and groups
  • Specify users and groups manually - Select from pdbedit output; group names are prefixed with @
Allow All Manual Selection
Access Control Details

Test smb.conf

Click the [Samba Test] button on the main screen.

Run testparm to validate the smb.conf syntax.
You can specify custom options and the path to the testparm command.

Manage Samba Users

Click the [Samba User] button on the main screen.

  • Add user - Create a new Samba user with smbpasswd -a
  • Change password - Change an existing Samba user's password
  • Delete user - Remove a Samba user with smbpasswd -x

User management operations require PolKit authentication.

Firewalld Settings

Click the [Firewalld] button on the main screen.

  1. Press [Load Zones] to load available firewall zones
  2. Select a zone from the dropdown
  3. Press [+] to specify a port number and protocol (TCP / UDP)
  4. Click [Open Port] or [Close Port]
Firewalld Main Zone Selection
Port Configuration

Systemd Service Control

Start, stop, and check the status of Samba services (smbd / nmbd) from the main screen.

Application Settings

Click the [Mode] button on the main screen.

Setting Description
Server Mode ON: Configure locally installed Samba. OFF: Configure Samba on a remote server.
Need Administrator Password When enabled, PolKit authentication is required for all privileged operations.
Font Size Adjust font size (small / normal / large).
Dark Theme Switch between Dark and Light themes. Requires application restart.
Language Switch between English and Japanese. Requires application restart.

About Qt

Click the [About Qt] button on the main screen to view Qt version and license information.

Security

  • All root-privilege operations are handled exclusively by SambaConfigHelper via D-Bus
  • Every D-Bus method requires PolKit authentication (auth_admin by default)
  • File path validation prevents path traversal attacks
  • D-Bus bus policy restricts service ownership to root
  • SELinux policy module available for mandatory access control

License

This software is licensed under the GNU General Public License v3.0 (GPLv3).

Copyright (C) 2026 Presire

Third-party license files are located in the ThirdPartyLicenses/ directory.

Library License File
Qt LGPL-3.0 ThirdPartyLicenses/Qt/LGPL-3.0.txt
Polkit-Qt1 LGPL-2.0-or-later ThirdPartyLicenses/Polkit-Qt1/LGPL-2.0-or-later.txt
Polkit LGPL-2.0-or-later ThirdPartyLicenses/Polkit/LGPL-2.0-or-later.txt
Samba GPL-3.0 ThirdPartyLicenses/Samba/GPL-3.0.txt

About

A Qt6-based GUI tool for configuring Samba on Linux. Edit smb.conf settings through a clean, intuitive graphical interface without manually editing config files. Easily manage shared folders, user access permissions, and global server settings with just a few clicks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors