Install and configure Samba on Ubuntu 20.04

Introduction: Samba is an open source software suite that allows file and printer sharing between different operating systems. Installing and configuring Samba on Ubuntu 20.04 is a convenient way to share folders in a local network, enabling multiple computers to easily access shared files. This article will show you how to install and configure Samba on Ubuntu 20.04.

Samba is a powerful software suite that provides the following key features:

  1. File Sharing: Samba allows folders and files to be shared between different operating systems. You can easily set up shared folders and allow users on other computers to access and edit those files.

  2. Printer sharing: In addition to file sharing, Samba also supports printer sharing. You can connect a printer to a computer running Samba and allow other computers to access and use the printer over the network.

  3. Authentication and access control: Samba provides several authentication methods, including user-based authentication and domain controller authentication. You can set access control lists (ACLs) to restrict access to shared resources to specific users or groups.

  4. File and Printer Discovery: Samba supports web browser protocols and can automatically detect and display shared folders and printers on the network. This makes it easy for users to find available resources and access them.

  5. Security: Samba supports data encryption and digital signatures to ensure the security of shared data during transmission. You can configure Samba to use Secure Sockets Layer (SSL) and Transport Layer Security (TLS) to encrypt data transmission.

  6. Group Policy Management: Samba also provides functionality similar to a Windows domain controller, allowing you to centrally manage users, computers, and group policies across your network.

Step 1: Install Samba

1. Open the terminal.

2. Enter the following command to install Samba:

sudo apt update sudo apt install samba

3. Enter your administrator password to confirm the installation.

Step 2: Configure Samba

1. In the terminal, use the following command to back up the default Samba configuration file:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

2. Use a text editor (such as Nano, vim) to open the Samba configuration file:

sudo vim /etc/samba/smb.conf

3. Add the following content at the bottom of the configuration file to create a shared folder:

[shared] comment = Shared Folder path = /path/to/shared/folder read only = no guest ok = yes

Replace /path/to/shared/folderwith the actual folder path you want to share.

or this:

2d0d6ef757844cb9864c37c77dfcd72d.png

4. Save and close the file (press Ctrl+O in Nano, then Enter, and finally Ctrl+X).

Step 3: Create Samba User

1. In the terminal, create a Samba user with the following command:

sudo smbpasswd -a username

Replace usernamewith the username you want to create and follow the prompts to set a password.

Step 4: Restart the Samba service

1. In the terminal, use the following command to restart the Samba service:

sudo service smbd restart

Step 5: Access the shared folder

1. On another computer, open the file browser.

2. Enter the following in the address bar:

smb://<Ubuntu IP Address>/shared  

will <Ubuntu IP Address>be replaced with the actual IP address of your Ubuntu computer. 3. Press Enter and you will be able to access shared folders and share files in your local network.

1e5527959f444862b3b37bebf41fa86d.png 315793ea5aa4410abe380137bb9586f6.png

Guess you like

Origin blog.csdn.net/weixin_53000184/article/details/130784488