Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Implement SAMBA (CIFS) Fileshares for Servers and Clients

Implementing fileshares for Windows and Linux servers, plus clients is a key skill for any experienced system administrator. In this activity, we will be working to set up a Linux Samba fileshare that can then be used by a remote client to store files on. Once this activity is completed, we will see how Samba can be used to provision a fileshare for use via a Linux client.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Nov 12, 2018

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install Samba Packages on the Samba Server

    We will need several packages installed on our server to complete this activity. Install the packages needed via:

    sudo yum install -y samba samba-client cifs-utils
    
  2. Challenge

    Install Samba Packages on the Samba Client Server

    Similar to the server install, we will need to install some packages on the client in order to use the share we are making available from the server. We can execute the package installation with:

    sudo yum install -y samba samba-client cifs-utils   
    
  3. Challenge

    Create the Server Fileshare and Set Universal Read/Write Permissions

    On the server, we are tasked with creating the fileshare location for our development team's documentation. Easily accomplished with:

    sudo mkdir /devdocs
    

    We can meet the accessibility requirement with the following command:

    sudo chmod 777 /devdocs
    
  4. Challenge

    Allow Network and Users to Access the Share

    Our private network is on 10.0.1.0/24 and you have a test user that we will be configuring access to this fileshare via the Samba server configuration file located at /etc/samba/smb.conf — we will need to edit the following values in the [global] section of that file so they appear as follows:

    security = user
    hosts allow = 127. 10.0.1.
    interfaces = lo eth0
    passdb backend = smbpasswd:/etc/samba/sambapasswd.txt
    

    Additionally, we will need to add a new section at the end of the configuration file for our share. We can accomplish this by adding the following values:

    [devdocs]
            comment = Development documentation
            read only = no
            available = yes
            path = /devdocs
            public = yes
            valid users = devdocsuser
            write list = devdocsuser
            writable = yes
            browseable = yes
    

    Optionally, once saved, we can perform a quick test with:

    sudo testparm
    
  5. Challenge

    Start the Samba Service

    Enable and start smb:

    sudo systemctl enable smb
    sudo systemctl start smb
    
  6. Challenge

    Make the Local Mount Directory on the Samba Client and Set Universal Permissions

    Run the following to establish the mount directory:

    sudo mkdir /mnt/devdocs
    

    Set up permissions with:

    sudo chmod 777 /mnt/devdocs/
    
  7. Challenge

    Test the Server Mount on the Client System via the Command Line

    We will need to provide a string of options to the mount command to test our access:

    sudo mount -t cifs -o user=devdocsuser,password=devdocs //10.0.1.100/devdocs /mnt/devdocs/
    

    Once mounted, we can check via df -h to see it in the list of mounted filesystems and we should be able to write a file and read it on either client or server system

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans