On Linux, Samba Server allows the file-sharing mechanism across the different operating systems in a network. It is an open-source software tool, beneficial for accessing desktop files from a Linux system and sharing with macOS, and Windows.
It contains a configuration file in which time-by-time modifications occur. So it is recommended to restart it after editing to make the changes effective.
This post pens down possible ways to restart Samba Server on Linux with the following highlights:
Method 1: Using the “systemctl” Command
The “systemctl” command-line tool manages the “systemd” initialization system and service manager. It allows the user to interact with the services using options such as “start”, “enable”, “stop”, “disable” and view.
Restart Samba Server
Execute the “systemctl” command followed by the “restart” options and the superuser privileges i.e “sudo” to restart the samba server:
$ sudo systemctl restart smbd
The error-free output confirms that “smbd(Samba)” server is restarted.
Check Samba Status
If the user wants to check the current status of the “Samba” server then use the “status” with the “systemctl” command:
$ sudo systemctl status smbd
The Samba server is now in “active (running)” state.
Method 2: Using the “service” Command
The other tool is the “service” command utility utilized to execute a SystemV init script located in the in /etc/init.d directory. It can also start, stop, restart, reload, and enable the services like the systemctl command.
Restart Samba Server
Type the “restart” flag alongside the “sudo” and “service” commands for restarting the “smbd” server in the following way:
$ sudo service smbd restart
It provides the same output as the “systemctl” command.
Linux offers the “systemctl” and “service” command line tools to restart the “Samba” server instantly. Both commands use the “sudo” i.e root user access if the normal user is logged in. All Linux distributions support these built-in command utilities. This post has demonstrated all possible ways to restart the Samba Server.