Blog Maintained by Eniac Technology

  • Tech Facts

    Over 3.8 billion people use the internet today, which is 40% of the world's population.

  • Tech Facts

    More than 570 new websites are created every minute.

  • Tech Facts

    There are over 3.5 billion searches per day on Google.

Sunday, March 29, 2020

How to install and setup Samba Server in Ubuntu/Linux


What is Samba?

Samba is program which allows end users to access and use file, printers and other shared resources over a network. Shared resources can also be accessed by other operating systems like Windows or Mac.

In this Guide we will be installing and configuring samba on Ubuntu server to access a folder through windows and mac.

Requirements

  • Ubuntu 16.04 or higher
  • Local area network to access files across.

If you have all the things ready, let’s begin.

Installing Samba

  1. Before installing samba we will make sure all our repositories are update by using command below
    sudo apt update
  2. Once the update is completed successfully we will be ready to install samba by using

    sudo apt install samba
  3. Optional: To check if the installation of samba is successful or not we can use the command

    whereis samba
  4. It should give you the following output
    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

Creating directory and setting up Samba Share

Now that we have installed samba we will be creating a new directory and sharing it across our network

  1. To create a directory we use the command mkdir
    mkdir /home/<your user name>/share
using above command we have created a new directory/folder which we will be sharing, also make sure that <your user name> should be replaced by your username on ubuntu. ie. mkdir home/geeksdice/share
  • To configure samba file we need to go to the path which is etc/samba/smb.conf. To edit the samba configuration file use the below command
    sudo nano /etc/samba/smb.conf
  • Using the above command will open the configuration file and at the bottom of the file the following lines needs to be added in order to share the folder we have created earlier
    [share]
    comment = My first share on Ubuntu
    path = /home/username/share
    read only = no
    browsable = yes
  • To save the file Ctrl+O (press and hold Ctrl button and press O) and to exit use Ctrl+X (press and hold Ctrl button and press X)
  • Once we have successfully saved the configuration file we need to restart samba services by typing
    sudo service smbd restart

    or by using the following command below

    sudo systemctl restart smbd
  • Now in order to access the files from other computers on the network we will need to allow samba through ubuntu firewall, to update ubuntu firewall we will type
    sudo ufw allow samba 
Creating users account for samba

  • In order to access samba we need to create user password as it does not use default username password, to setup samba password for our user we will type
    sudo smbpasswd -a username
Note: Username must be same as your system account else it won’t be saved
Connecting to a share

On Windows: Go to run type the path of your share and press OK

On Ubuntu: Open the file manager type the path and press enter
On MacOS: On the finder menu click Go> Connect to the server type the path and press enter
Below is the a video demonstrating installation of samba server

In this post we have assumed that you already have a Ubuntu/Linux server installed but in case you want us to write a post on how to install samba server, let us know on the comments section below.

Share:

About US

Geeksdice.com is a technology blog maintained and run by Eniac Technology. At Eniac we provide Information Technology services.
Powered by Blogger.

Search This Blog