Configure a Samba Server and Client and Mount a File System on Linux

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

NFS and Samba are both used commonly as file-sharing solutions between Linux servers. In this lab, you’ll learn to configure a Samba server and a file share. You’ll then create a Samba user. Next, you’ll configure a Samba client and mount the file system from the server to the client.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Samba, Add a User, Create a Directory, Check selinux Status, and Set File System Context
  1. Install the Samba package.
  2. Start the Samba service.
  3. Enable the Samba Service.
  4. Add the smbuser1 user to the system.
  5. Set the password for user smbuser1.
  6. Create a directory named /smbuser1.
  7. Change the permissions to read, write, execute on /smbuser1.
  8. Check the status of selinux.
  9. If running, set the context of /smbuser1 to samba_share_t.
Edit the Samba Configuration and Add a Share, Test the Configuration, and Restart the Samba Service
  1. Configure a Samba share named /smbuser1 with read and write access for user smbuser1.
  2. Test the configuration file for syntax errors.
  3. Restart the Samba service.
  4. Get the Samba server system IP address.
On the Client Server, Install the CIFS package, Configure a Persistent Mount, and Test the File System
  1. Install the CIFS utilities package.
  2. Create the mount point, /mnt/smbuser1.
  3. Grant read, write, and execute permissions on /smbuser1.
  4. Configure /mnt/smbuser1 to mount persistently on Server2.
  5. Configure a credentials file for mount authentication.
  6. Mount the file system.
  7. Verify the file system is mounted and has read and write access.
  8. Mount -a

Additional Resources

Scenario

The Database team needs a new user and a home directory created for the user, smbuser1, on the Samba server, server1. It should be permanently mounted with read and write access on the Database server, server2. To complete this lab, configure a Samba server with a Samba share named /smbuser1 on server1, and mount it on server2 with read and write permission as /mnt/smbuser1. Test the configuration by writing a file name file1 in the directory. Good luck!


Your lab contains 2 Cloud Server instances. Open 2 Terminal tabs, and log in to both of the provided server instances using the credentials provided. Use one of these instances for server1 (the server) and use the other for server2 (the client):

ssh cloud_user@<PUBLIC_IP_OF_NODE>

Become the root user on both instances:

sudo -i

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?