Operations 5 min read

How to Set Up Samba for Seamless Windows‑Linux File Sharing on CentOS

Learn step‑by‑step how to install, configure, and use Samba on a Linux server to create shared folders accessible from Windows, covering package installation, service startup, user creation, configuration file editing, permission settings, and GUI tools, with practical command examples and screenshots.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Set Up Samba for Seamless Windows‑Linux File Sharing on CentOS

1. Why Use Samba

When sharing files between Windows and Linux virtual machines, Samba provides a convenient solution that avoids the time‑consuming copy‑and‑paste process and allows direct compilation in the shared directory, despite the differing file systems.

2. Install and Start Samba Service

1) Install Samba using yum yum -y install samba* 2) Start and verify the service

service smb start
service nmb start

Check open ports (137, 138 UDP; 139, 445 TCP) with ss -tnl.

3) Create a shared user

smbpasswd -a alren
setfacl -m u:alren:rw /home/alren

4) Access the share from Windows by browsing the network and logging in with the created credentials.

3. Create a Shared Filesystem

1) Create the shared folder mkdir /share/test 2) Edit Samba configuration ( /etc/samba/smb.conf ) and add a share

[myshared]
comment = shared files
path = /share/test
write list = chen

3) Set ACL permissions setfacl -m u:chen:rwx /share/test 4) Test access from Windows by entering the server IP address.

5) List shares on the server smbclient -L server -U username 6) Connect interactively to a share

smbclient //server/shared -U username

4. Common Samba Configuration Options

1) /etc/samba/smb.conf parameters

[shared]
comment = # comment
path = # directory to share
read only = # yes/no
writeable = # yes/no
public = # allow guest access
guest ok = # allow guest login
write list = # users or groups with write permission

Users example: hadoop, centos; groups: @groupname, +groupname.

2) Test configuration syntax testparm 3) Mount a CIFS filesystem

mount -t cifs //server/shared /path/to/mount_point -o username=smbuser

5. Configure Samba via GUI

1) Install the GUI package yum -y install samba-swat 2) Enable the GUI by configuring the samba‑swat package.

3) Verify the GUI port (901) is open

4) Access the GUI via a web browser using http://<i>server_ip</i>:901

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxWindowsSystem AdministrationCentOSfile sharingSamba
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.