rss logo

Quick and Simple Samba Share Setup on Debian

samba linux logo

In this tutorial, I'll show you how to quickly set up a Samba server on Debian. The aim is to have a network share available as quickly as possible from Windows, GNU/Linux or any smb compatible device. Personally, I often use it to create a temporary share when I need it.

Installing

  • Simply enter the following commands to install the samba package:
root@host:~# apt update && apt install samba

Configurations

We can now move on to configuration. First, we need to configure the IP address to which Samba clients will connect, followed by the Samba server configuration.

Network configuration

  • Edit the /etc/network/interface file, taking care to change the name of its network card according to its own configuration:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface # This is an autoconfigured IPv6 interface allow-hotplug eth0 iface eth0 inet static address 192.168.1.200 netmask 255.255.255.0 gateway 192.168.1.254
  • Then restart the system to take the change into account:
root@host:~# reboot

Samba configuration

  • Create a share folder:
root@host:~# mkdir /share
  • Create a samba user:
root@host:~# adduser --home /share --system samba
  • Set permissions on the previously created folder:
root@host:~# chown samba: /share
  • Set a password (associated with the samba user) for access to the share:
root@host:~# smbpasswd -a samba
  • Clears the current config:
root@host:~# > /etc/samba/smb.conf
  • Then edit /etc/samba/smb.conf:
[global] workgroup = WORKGROUP server string = serv01 [share] path = /share read only = no valid users = samba
  • Check configuration:
root@host:~# testparm
  • And finaly, restart your Samba services:
root@host:~# systemctl restart smbd; systemctl restart nmbd

Congratulations, sharing is ready! 🤝 The share will be accessible with the samba login and password previously defined with the smbpasswd command.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address