How to install and configure samba on Ubuntu linux?

User Avatar
👤 admin
🔴 Admin
✍️ The most important thing in the world is to not be alone.
⏳ Last active: 15 Apr 2025 at 16:01
📅 Created: 14 Feb 2021 at 16:58
👀 Viewed: 20 times
✉️ Send Email

Samba is a free software re-implementation of the SMB networking protocol, and was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients and can integrate with a Microsoft Windows Server domain, either as a Domain Controller (DC) or as a domain member. As of version 4, it supports Active Directory and Microsoft Windows NT domains.

Samba runs on most Unix, OpenVMS and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple's macOS Server, and macOS client (Mac OS X 10.2 and greater). Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well. Samba is released under the terms of the GNU General Public License. The name Samba comes from SMB (Server Message Block), the name of the proprietary protocol used by the Microsoft Windows network file system.

Install:


sudo apt-get install samba

Add user for samba


sudo smbpasswd -a sonik

Make a directory to share:


mkdir /home/sonik/sarg

mkdir /home/sonik/public

Edit the config file:


pico /etc/samba/smb.conf

Add at the bottom of the file the new directory that we created:


[sarg]

# This share allows only authenticated users

path = /home/sonik/sarg

available = yes

valid users = sonik

read only = no

browseable = yes

public = yes

writable = yes

[guest]

# This share allows anonymous (guest) access

# without authentication!

path = /home/sonik/public

read only = no

guest ok = yes

Restart samba:


sudo /etc/init.d/samba restart

Test samba config:


sudo testparm

How to check samba version?


smbstatus
If you want to comment: Login or Register