How to install and configure Samba server in Ubuntu from terminal

0
70
How to install and configure Samba server in Ubuntu from terminal

Samba is one of the great alternatives that exist to share files in hybrid environments where Windows and Linux computers coexist. It is only necessary to install and configure the application in Ubuntu from the terminal.

Samba is nothing more than a communication protocol that allows computers with a Windows operating system to connect to the Linux file system. This way you can access Linux folders, files and network drives in Windows.

Requirements to install Samba on Ubuntu

  • Ubuntu operating system version 18.04 onwards

  • Admin user permissions to access sudo app
  • Internet access
  • A terminal with Windows operating system to test the configuration

How to install and configure Samba

Having everything we need to start with the installation of the application, it is time to write the necessary commands. Try not to skip any steps.

Samba Installation

  • Access sudo and enter the command to start the Samba installation. sudo apt install samba samba-common python-dnspython.
  • To start the download type the letter S.

Check workgroup in Windows terminal

  • One way to verify the workgroup is by right-clicking on the This PC icon and then choosing the Properties option.
  • Through the Windows Command Prompt you can verify the workgroup and domain by placing the net config workstation command. We will use it later for the configuration of the smb.conf file.

Check workgroup in Windows terminal

Edit smb.conf file

  • Make a backup copy of the smb.conf file in case of failure. type the command sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.orig.
  • Now you can edit the file. Set secure file transfer settings with the secure file sharing command
  • Set the value of insecure anonymous by putting in sudo unsecure Anonymous
  • Create the directory where the files are shared by typing sudo mkdir -p /srv/samba/anonymous_shares
  • Now add the access permissions to the files with the commands sudo chmod -R 0775 /srv/samba/anonymous_shares and sudo chown -R nobody:nogroup /srv/samba/anonymous_shares

Modify the configuration file

  • Access the configuration file from an editor and modify the values ​​vi: sudo vi /etc/samba/smb.conf and nano: sudo nano /etc/samba/smb.conf
  • Edit the directives in the Global section of the file. Put the following values: workgroup = WORKGROUP, netbios name = ubuntuX, security = user
    [Anonymous]

    comment = Anonymous File Server Share, path = /srv/samba/anonymous_shares, browsable =yes, writable = yes, guest ok = yes, read only = no, force user = nobody

  • To finish, save the changes made to the file with the key combination Ctrl + O and exit the editor.
  • To verify that everything works correctly, run the testparm command.

Select shared folder

  • Select or create the folder that you want to be available for terminals with Windows 10.

  • Single click on the folder and then right click to select the Local Network Share option.
  • The Folder Sharing window opens to enable the Share this folder option. The other available options are automatically enabled and to finish press the Create Share button.
  • Finish the process by clicking on Add the permissions automatically.
  • The folder will be displayed with an arrow next to the folder icon to indicate that it is a shared folder. Do this same process with the folders you want to share.

Advantages of using Samba

use-samba-ubuntu

Samba was created by Andrew Tridgell and he did it through reverse engineering. I create compatibility for Unix environments using traffic grabbers very similar to Wireshark.

By using samba you choose what you want to share and how you want to share it. Initially it uses anonymous shares, where you share any content without restrictions and in other cases you can protect the files with access data.

Previous articleHow to merge several VOB files into one – Easy and fast
Next articleHow to find people from the same city or town on Facebook

LEAVE A REPLY

Please enter your comment!
Please enter your name here