Configuring Samba for Linux

Configuring Samba for Linux

A Samba file server provides seamless file sharing across different operating system platforms over a network. This beginner guide will cover the setup of Samba on Ubuntu. (Ubuntu does offer an excellent installation and configuration guide for samba.

Step 1: To install Samba, run the following command in Terminal.

sudo apt update

sudo apt-get install samba

To verify that the installation of Samba was successful, type in this command in Terminal.

whereis samba

The output show show as follows:

samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz

Step 2: Setting up Samba.

It is now necessary to create a directory to share now that Samba has been successfully installed. This command line below creates a new folder sambashare in our home directory which we will share later.

mkdir /home/<username>/sambashare/

The configuration file for Samba is located at /etc/samba/smb.conf. To add the new directory as a share, proceed to edit the file by executing the following command line.

sudo nano /etc/samba/smb.conf

At the bottom of the file, add the following lines:

[sambashare]

??? comment = Samba on Ubuntu

??? path = /home/username/sambashare

??? read only = no

??? browsable = yes

To save the file, press Ctrl-O and Ctrl-X to exit from the nano text editor.

The comment section adds a brief description of the Samba share.

The path is the directory of the shared folder.

The read only permission allow one to modify the contents of the share folder is only granted when the value of this directive is no.

The browsable section is set to yes so that file managers, such as Ubuntu’s default file manager, will list this share under “Network” (it could also appear as browsable).

For the new shared configuration to take effect, proceed to save it and restart Samba for it to take effect with the following command line.

sudo service smbd restart

Proceed to update the firewall rules to allow Samba traffic:

sudo ufw allow samba

Step 3: Setting up User Accounts and Connecting to Share

Since Samba doesn’t use the system account password, we need to set up a Samba password for our user account:

sudo smbpasswd -a username

Special note: The username used must belong to a system account. Otherwise, it will not save.


Connecting to Share

A quick way to find your IP address in Ubuntu is using the ip a command in Ubuntu’s terminal.

On Ubuntu: Open up the default file manager and click Connect to Server then enter: ubuntuctn

On macOS: In the Finder menu, click Go > Connect to Server then enter: macosctn

On Windows, open up File Manager and edit the file path to:

\\ip-address\sambashare

Note: ip-address is the Samba server IP address and sambashare is the name of the share.

As a final step, you will be prompted to enter your credentials to proceed to connect to the Samba folder.

?

要查看或添加评论,请登录

Nicholas Mutsaerts的更多文章

  • How to install ClamAV Ubuntu

    How to install ClamAV Ubuntu

    Linux is generally less prone to malware compared to other operating system. Nonetheless, it is good practice to…

  • Security Risks of Autofill and Saved Passwords

    Security Risks of Autofill and Saved Passwords

    Autofill and password-saving features are designed to simplify online experiences by quickly filling in forms and login…

  • How to Setup a Firewall in Linux

    How to Setup a Firewall in Linux

    Why Set Up a Firewall? Setting of a firewall for Linux lies in three primary reasons: Security: A firewall safeguards…

  • Effective Backup Methods for Ubuntu

    Effective Backup Methods for Ubuntu

    Data loss can have a significant impact on home and business environments. Backing up files is crucial for safeguarding…

    1 条评论
  • How to schedule a PowerShell Script

    How to schedule a PowerShell Script

    Proceed to follow this step-by-step guide on how to use Task Scheduler in Windows. Step 1: Open Task Scheduler Press…

  • The Importance of Clearing Your Cache

    The Importance of Clearing Your Cache

    Clearing your cache is a simple and effective way to optimize your digital experience, ensuring faster load times…

  • Customizing Linux and GNOME Tweaks

    Customizing Linux and GNOME Tweaks

    GNOME Tweaks is a versatile tool designed to customize the GNOME desktop environment. It provides an intuitive…

  • Understanding File Management in Linux

    Understanding File Management in Linux

    We will show how to understand basic file management in Linux for new users. Nautilus is the default file manager for…

  • How to add users and groups in Linux

    How to add users and groups in Linux

    For Linux administrators, managing user and groups is a fundamental aspect of Linux system administration as it allows…

    1 条评论
  • PowerShell Scripting

    PowerShell Scripting

    PowerShell scripting has become an essential tool for help desk professionals and system administrators, enabling them…

社区洞察