News
Seven days of Black Friday madness — great deal from Serverspace!

THE NEW YEAR
WHEEL OF FORTUNE

Spin the wheel and win a guaranteed prize right now!

By registering, you are signing up to receiving emails.
DF
May 4 2023
Updated June 13 2023

Setup Samba on CentOS

CentOS Samba

Using another OS?

Select the desired version or distribution.

Intro

Samba is an open source software designed to streamline file and printer sharing across multi-platform networks. It operates on the SMB protocol, which is responsible for managing file and printer sharing in Windows systems. Samba allows users to create shares on their computers that can be accessed by other devices on the network, simplifying the process of file sharing. Its key features include data encryption, user authentication, and remote resource access. Since its inception in 1991, Samba has become a popular alternative to proprietary solutions for file sharing and printing in Windows networks. It is currently one of the most widely used software applications for network file and printer sharing, and can even act as a domain controller to manage user accounts and groups on the network. Additionally, Samba offers the option of creating a web server for file sharing over the Internet.

Install Samba

Initial, deploy programs by inserting:

sudo yum install samba samba-client samba-common
sudo-yum-install samba-samba-client samba-common
Screenshot №1. Install samba packages

Making shared catalogs

Making catalogs for file sharing is the next process.
Do it:

sudo mkdir /home/username/share1

Operating system support creation multiple directories for different users or groups.

sudo-mkdir-share1
Screenshot №2. Creating new shared folder

Configuration

Afterward, it is necessary to modify config file /etc/samba/smb.conf. Perfom:

sudo nano /etc/samba/smb.conf

That file contains many lines of code.
For application to start correctly, let s edit some of them.

sudo-nano-smb.conf
Screenshot №3. Default settings of smb.conf

Access settings

Access settings must be configured by adding the lines:

[share1]
path = /home/username/share1
valid users = username
read only = no
edit-smb.conf
Screenshot №4. Edit smb.conf

Creating Users

To create Samba users,  perform:
Create user in OS:

adduser username

Then set password in smb:

sudo smbpasswd -a username
sudo-smbpasswd-a username
Screenshot №5. Add new user to smb.conf

Restart Samba

Finally, we restart the Samba service to apply the settings by typing:

sudo systemctl restart smb

You can now try to connect to shared folders from another computer on the network using the username and password you created earlier.

sudo-systemctl-restart smb
Screenshot №6. Restart smb service

Conclusion

Samba is an excellent tool for sharing files and printers between computers on a local network. This article provides a comprehensive guide for setting up a Samba server on CentOS.

You may be also interested in

Vote:
4 out of 5
Аverage rating : 4.7
Rated by: 3
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.