Restart Samba Server In 2 easy Commands

restart samba

Learning to restart samba is quite essential if you run your samba server. Samba is a suite of Linux programs that could set up a full-blown server on a Linux machine. Despite being a native Linux program, it is fully interoperable and compatible with Microsft client hosts. Samba is a versatile suite of programs. It can be installed on multiple programs like Linux, Unix, FreeBSD, etc. It can interact with Windows clients remotely and send, receive, or store data on its file system using the CIFS (Common Internet File System) protocol. This article provides you with complete detail on installing, starting, or restarting the samba server.

What is samba?

According to its official website, It is a complete software package that allows the network administrator to choose the setup, configuration, and system equipment. It was initially released in the year 1992 and is still widely used. The Samba software suite is used to provide services to clients irrespective of their platform, whether Windows, OSX, Linux, or others, using the SMB/CIFS Protocols. Enthusiasts often use the samba suite of software you run their personal storage server.

Installing Samba on Linux

Samba is a free and open-source project, just like Linux itself. Anyone can download it, use it or modify it as per his needs. It can be downloaded and installed on Linux using multiple ways. It could be installed using the default package manager of your Linux distro, or you could download its source code from its official git repository and then build it locally on your computer. In this section, we show you how to install and start samba using the default package manager on Debian-based Linux distros and Arch-based Linux. After installing Samba run the “samba –version” to verify your download.

Installing Samba on Debian-based Linux

Debian-based distributions are pretty popular among users, such as Ubuntu. Mint, Kali, etc. All Debian-based Linux distributions use dpkg as their default package manager. Follow the given instructions to install and start samba on Debian Linux.

  • Open the terminal emulator (CTRL + ALT + T ).
  • In the bash shell, type “sudo apt update “.
  • Enter your root password to continue.
  • Let the repository database update.
  • Now when done, type “sudo apt install samba“.
  • Let the download comlplete and it would install auotmatically.

Installing Samba on Arch-based Linux

Popular Arch-based Linux distributions are Manjaro, EndeavourOS, Vanilla Arch itself, etc. The default package manager for all Arch-based Linux distributions is Pacman. Follow the given steps to install and start samba on Arch Linux.

  • Open the terminal emulator (CTRL + ALT + T ).
  • In the bash shell, type “sudo pacman -Syu” to sync repositories.
  • Enter your root password to continue.
  • Let the repository database update.
  • Now when done, type “sudo pacman -S samba“.
  • Let the download comlplete and it would install auotmatically.
I am synchronizing the package database Arch-Linux.
I am synchronizing the package database Arch-Linux.
I am installing samba on Arch-Linux.
I am installing samba on Arch-Linux.

Start Samba Server

Before you directly start or restart samba server, there are a lot of configurations and file access management stuff that need to be taken care of. We show you how to properly configure and restart the samba server without any security flaw or misconfiguration to work seamlessly with its windows or other clients. Follow the provided steps to restart samba server.

  • Create a directory that you would share using samba.
mkdir /home/_username_/sambashare/
  • Now add the created shared dircttory, to the samba configuration file. The following command open the samba configuration file.
sudo nano /etc/samba/smb.conf

At the bottom of the configuration file, add the following information. After editing the file, press Ctrl + O to save the file and Ctrl + X to exit the nano text editor.

configuration to restart samba
Add this information to the configuration file.
  • Now restart samba services to make are changes effective.
sudo service smbd restart
  • Now config the firewall to allow samba use the network bandwidth.
sudo ufw allow samba
  • Now set-up a samba user account to connect to the samba server. The name of the account must match the system account name or it won’t work correctly, set a different password of your choise for the samba account.
sudo smbpasswd -a username

After this configuration, you are ready to access the samba shared folder in your local network using the local IP of your samba installed machine. To know your local IP run the ‘ifconfig’ command in the terminal shell and look for an inet address concerning your network interface. Use this local IP from another system in your network to access the shared samba folder content.

We are finding local IP using ipconfig in Linux.
We are finding local IP using ipconfig in Linux.
  • Access the shared folder from a different system using the windows file explorer with the local IP of your samba server and shared folder. Enter the URL in “smb://192.168.43.12/sambashare” like format. you would be prompted to enter your username and password to gain access to the shared folder.

Restart samba services

If your samba version is not working as intended or you have made some changes in the smb.conf file, but the changes do not seem to appear. In such a scenario, you need to restart samba services to get them working correctly and updated as you intended. Run the following command in the terminal shell to restart samba services.

sudo service smbd restart

This command would stop the samba services and start them over again. If you recently updated or installed your samba package, then chances are this command wouldn’t work. If the above command doesn’t work, run the following command to restart samba services.

sudo /etc/init.d/samba restart

Restart Samba Ubuntu

Ubuntu is by far is one of the most popular Linux distributions. Ubuntu server is used widely in the server space to run server services like Samba or apache server. The following commands can be used to restart the samba services on your Ubuntu server.

  • To stop the samba server.
sudo service smbd stop
  • To start the samba server.
sudo service smbd stop
  • To restart the samba server.
sudo service smbd restart

Restart Samba Server on Raspberry pi

Raspberry pi is a mini-computer that runs the Debian-based Raspberry OS. The following commands can be used to start, restart, stop and check the status of the Samba services on the Raspberry pi computer.

sudo service smbd status.
// to check the status of service

sudo service smbd start.
// to start the service.

sudo service smbd stop.
// to stop the service completely

sudo service smbd restart.
// to restart samba services.

Restart samba without disconnecting users

If you’ve made changes in the smb.conf file and want to make the change work without disconnecting the current user, run the following command in the terminal emulator to restart only the service configuration without disconnecting the users.

smbcontrol smbd reload-config
// This command would load the config changes without alterning current users.

Samba restart vs reload

The main difference between samba restart and reload is that the samba restart command stops the service entirely, disconnecting all the current connected users and then starting the service again from scratch. While the samba reload command does not stop the samba service entirely, it just reloads the configuration file again in the working memory with the newly updated configuration with minimum effect on the connected users.

FAQs on Restart Samba Server

Does ifconfig work on Windows?

Its windows counterpart is ipconfig, which works the same.

What does sudo mean?

Sudo is short for SuperUser Do. In Linux, it shows that the following command is being executed in the context of the root user.

How to check if the samba services are running or not in Linux?

Run the sudo systemctl status smbd command to check the status of samba services.

Conclusion

Samba is a great tool that you could use to set up your own local storage or file server inside your local network. It is free, open-source, and easy to use than its counterpart server softwares. In this article, we provided you with enough information about its installation and basic setup process to help you get started with samba. We also offered two specific commands to restart samba services again.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top