---
title: 'How to set up a Samba server on Linux and connect | Zomro'
description: 'Samba is a free suite of software that allows the Linux operating system or other Unix-like system to act as a file and print server for computers.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/04/03/image-20230403090736-1.jpg'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * How to set up a Samba server on Linux and connect to it from Windows Server 2019 



# How to set up a Samba server on Linux and connect to it from Windows Server 2019

02-04-2023

Samba is an open source software suite that provides file and print services for Windows, Linux, and macOS clients. It allows Linux based servers to share files and printers with Windows based clients and vice versa. In this article, we'll show you how to set up a Samba server on Linux and connect to it from Windows Server 2019.

Installing Samba on Linux  
You can use your distribution's package manager to install Samba on a Linux server. For example, if you are using Ubuntu or Debian, you can install Samba by running the following command in a terminal:

> sudo apt-get install samba

If you are using CentOS or Red Hat Enterprise Linux, you can install Samba by running the following command:

> sudo yum install samba

![How to set up a Samba server on Linux and connect to it from Windows Server 2019 - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/04/03/image-20230403090736-1.jpg)

Once the installation is complete, you can start the Samba service by running the following command:

> sudo systemctl start smbd

**Setting up Samba**  


The Samba configuration file is located in /etc/samba/smb.conf. You can modify this file to define the shares you want to make available to Windows clients.

To create a new share, add the following section to the smb.conf file:

> [share_name]  
>  comment = Share description  
>  path = /path/to/share  
>  browsable = yes  
>  guest ok = no  
>  read only = no  
>  create mask = 0755  
>  directory mask = 0755

Replace share_name with the name of the share and //path/to/share with the path to the directory you want to share.

The comment field is an optional description of the share that will be displayed to users. The browsable field specifies whether the share is visible on the Windows network. The guest ok field allows anonymous access to the share if set to yes, and read only specifies whether clients can modify files in the share or not.

The create mask and directory mask fields indicate the default permissions for new files and directories created on the share.

After making changes to the smb.conf file, you can check the configuration by running the following command:

> sudo testparm

This command will check the smb.conf file for errors and print the current Samba configuration.

![How to set up a Samba server on Linux and connect to it from Windows Server 2019 - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/04/03/image-20230403091543-3.jpg)

We also restart the smb service if the data is not pulled up:

> systemctl restart smbd

**Creating Samba Users**

Samba uses its own user database, which is separate from the system user database. To create a new Samba user, run the following command:

> sudo smbpasswd -a username

Replace username with the username you want to create. When you run this command, you will be put into password entry mode for the user.

But before that, you need to create a UNIX user that you want to add. Let's use the command:

> useradd user1

Where user1 is the user we want to add for Samba.

![How to set up a Samba server on Linux and connect to it from Windows Server 2019 - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48%40server-panel.net/2023/04/03/image-20230403092030-4.jpg)

**Connecting to a Samba server from Windows Server 2019**

To connect to a Samba server from Windows Server 2019, follow these steps:

  1. Open File Explorer on Windows Server 2019.
  2. Right-click on an empty area of the window and select "Network Connection".
  3. Enter the address of the Samba server in the address bar in the format \\\server_address, replacing server_address with the IP address or name of the Samba server.
  4. Press "Enter". If you have set up anonymous access to a share, you can access it without authentication. Otherwise, Windows will ask you to enter the username and password you created on the Samba server.
  5. Once connected to a Samba server, you can view shares and work with files and folders as if they were on a local drive.



**Conclusion**

Samba is a powerful tool for sharing files and printers between Linux based servers and Windows based clients. Setting up a Samba server on Linux may require some knowledge of network protocols and configuration, but in general it is a fairly simple process. Connecting to a Samba server from Windows Server 2019 requires minimal configuration and allows you to work with shares on the Samba server as if they were local.

Similar articles:

[How to change the SSH connection port and disable password authorization](https://zomro.com/blog/faq/236-kak-izmenit-port-podkljuchenija-po-ssh-i-otkljuchit-avtorizaciju-po-parolju) [How to install and configure fail2ban in Centos 7](https://zomro.com/blog/faq/366-how-to-install-and-configure-fail2ban-in-centos-7) [How to install HestiaCP](https://zomro.com/blog/faq/245-kak-ustanovit-hestiacp) [How to check for viruses Linux server](https://zomro.com/blog/faq/339-kak-proverit-na-virusy-linux-server) [Hosting: Creating databases by api in Cpanel](https://zomro.com/blog/faq/216-hosting-sozdanie-baz-dannyh-po-api-v-cpanel)

[ Dedicated servers from €88.80/mon ](/dedicated-servers)
