Next Batch: Cisco CCNA Evening Class 5th February 2024.

Blog

How to Install and Configure Samba File Sharing.

image
Linux / Windows / Windows 10

How to Install and Configure Samba File Sharing.

How to Install and Configure Samba File Sharing.

How to Install and Configure Samba File Sharing.

Samba is an open-source application suite that implements the Server Message Block (SMB) protocol. For client-server networking, several operating systems, including Microsoft Windows, employ the SMB protocol. Samba allows Linux and Unix workstations to connect with Windows machines on a network. Samba offers file and print services for multiple Microsoft Windows clients and may interface with a Microsoft Windows Server domain, either as a Domain Controller (DC) or as a domain member.

Sharing files is a critical component of server administration. It enables the sharing of network resources required by users to complete their jobs. Samba server is often deployed on a central Linux server where information is stored on various media and accessible via a Windows client or a Linux client utilizing Samba.

1. Making certain that the server is up to date

Before we start, please confirm that our server is up to date and that all packages are in the most recent version. To accomplish this, use the following commands:

sudo apt update

sudo apt upgrade –y

If there are packages to be upgraded, the above command might take a few minutes.

2. Setup Samba packages

Samba packages are available in the Ubuntu default repository. Install them with the following command:

sudo apt-get install samba

To continue, hit y and then enter when prompted to confirm the installation process.

We can determine whether the installation was successful by running:

$ whereis samba

samba: /usr/bin/samba /usr/lib/x86 64-linux-gnu/samba /etc/samba /usr/share/samba /usr/share/man/man8/samba.8.gz /usr/share/man/man7/samba.7.gz /usr/share/man/man7/samba.7.gz

This command will confirm the installed software package version:

3. Setting up Samba shares

The samba configuration file may be found in /etc/samba/smb.conf. Before making any changes, let us make a backup so that if we make a mistake, we have a copy. To generate a backup file, use the following command in the terminal:

Start by creating a backup file for samba just in case you want to reset the smb.conf file.

Sudo copy /etc/samba/smb.conf /etc/samba/smb.conf.bk

Let us now construct a shared directory.

Sudo mkdir -p /home/{username}/Documents/Sambashare/public_share

Let us now modify the samba configuration to define the export for the newly formed directory.

Open the configuration file:

Sudo vim /etc/samba/smb.conf

Update the file’s settings to reflect the following:

[Public_share]

path = /home/{username}/Documents/Sambashare/public_share

comment = Citizix Samba Shares

browsable = yes

editable = yes

guest allowed = yes

read only = no

create mask = 0775

Save and exit the file.

Use the following command to validate the configuration:

Note:

Permission precedence

Samba comes with different types of permissions for share. Try to remember a few things about UNIX and Samba permissions.

(a) Linux system permissions take precedence over Samba permissions. For example, if a directory does not have Linux write permission, setting samba writeable = Yes (see below) will not allow writing to shared directory/share.

(b) The file system permission cannot take priority over Samba permission. For example, if the file system mounted as read-only setting writeable = Yes will not allow to write to any shared directory or share via samba server.

Limits set by kernel-level access control such as file permissions, file system mount options, ACLs, and SELinux policies cannot be overridden by Samba. Both the kernel and Samba must permit the user to perform an action on a file before that action can occur.

How do I set permissions to Samba shares?

Samba Basic permissions are as follows (configuration file is smb.conf [/etc/samba/smb.conf]):

read only: This parameter controls whether a user has the ability to create or modify files within a share. This is the default.

guest ok: If this parameter is set to yes, the users will have access to the share without

having to enter a password. This can pose a security risk.

writeable: Specifies users should have write access to the share.

#How to Install and Configure Samba File Sharing.

Leave your thought here

Your email address will not be published. Required fields are marked *

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare