Basic Samba Setup And Installation On Linux Mint 13

One of the most common uses of a Linux Mint 13 machine – whether a server or a desktop – is to share files across the network. If you’re not familiar with the term, “file sharing” means to make a folder on your system available to clients on the network. From their own machines, users are able to access your shared folder from their computers, and depending upon how you’ve configured the security, they can copy the files for themselves, alter the files, add new files, or even delete files.

There are a number of different programs that offer file-sharing capabilities. Most Linux Mint 13 systems use the “Samba” software, since it is can easily share files with Windows-based computers. It’s common to find organizations that have a number of users with Windows systems storing their data on a Linux server running Samba.

In this post we’ll show you how to set up a basic Samba server, and how to access those shares from client computers, on a Linux Mint 13 machine.

Samba has a vast array of options and configuration settings, but here we’ll show you how to set up and configure a basic Samba server with one user.

First, you’ll need to install Samba. Make your way to a command prompt and type this command:

sudo apt-get install samba

Enter your password to authenticate, and apt will download and install Samba and its attendant utilities for you.

It’s important to realize about Samba is that it stores its own set of user accounts, separate from the main accounts, in the /etc/samba/smbpasswd file. That means you’ll need to create a separate Samba password for every user you want to access your file shares. You create this password using the smbpasswd command. For example, to create a command for a user named camalas, here’s how the command should look:

sudo smbpasswd -a camalas

Be sure to give camalas’s Samba account an appropriately strong password (make sure it includes uppercase, lowercase, punctuation, and numbers). Once camalas’s password is created, the next step is to create a directory for her to share. Begin by creating a folder named ‘test’ in camalas’s folder, which we’ll use for our first shared folder:

mkdir /home/camalas/test

(NOTE: DO NOT use sudo to create the folder, because then the owning user and group will be set as ‘root’, which means you won’t be able to access the folder using your Samba username and password.)

The next step is to edit the /etc/samba/smb.conf file, the main configuration file for Samba. As always, make a safe backup copy of the original smb.conf file to your home folder, in case you make an error:

sudo cp /etc/samba/smb.conf ~

Now use vi to edit the /etc/samba/smb.conf file:

sudo vi /etc/samba/smb.conf

The smb.conf file is long and rather complex, but for the purposes of this demonstration, you can ignore most of it. Key down to the very end of the file and insert this text:

[test]

path = /home/camalas/test

available = yes

valid users = camalas

read only = no

browsable = yes

public = yes

writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.)

Here’s what some of the more important configuration options mean.

-The “[test]” gives the name of the file share.

-The “path” option specifies the location of the folder to be shared.

-The “available” option specifies that the file share is available to clients on the network.

-The “valid users” option details the users that are allowed to access the file share. In this case, we’ve set it so that only the camalas account can access it. You can add additional accounts here, if you prefer.

-The “read only” options specifies whether nor not clients will be allowed to write to the file share.

-The “writable” option specifies that data can be written to the file share.

The settings specified above will share the test folder we created earlier, and give your username and your username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit vi, and restart Samba with this command:

sudo restart smbd

(This will force Samba to restart, re-reading its configuration files and activating the share you just created.)

Once Samba has restarted, use this command to check your smb.conf for any syntax errors:

sudo testparm

If you pass the testparm command, Samba should be working. Try accessing the share from another client on your LAN.

-JM

ADDITIONAL READING:

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide.

This entry was posted in Linux Mint 13. Bookmark the permalink.

12 Responses to Basic Samba Setup And Installation On Linux Mint 13

  1. Jon says:

    Well written and thorough post. As a novice Linux user, this is just what I needed. I’m Running Mint 13 with a Win 7 virtual machine and another Win 7 networked PC.

    Thanks!

  2. Pingback: Raspberry Pi XBMC » Kim Nørrebo

  3. Pingback: Linux Mint 13 “Maya” Released » Kim Nørrebo

  4. James says:

    I have 5 windows 7 pc and 1 Linux mint 13 pc in my LAN. I am using the Linux mint pc while the other people use windows 7. How can I connect to their pc and view their shared files and also enable them to view mine. I cannot even connect them. I have tried installing samba but I don’t know how to use it.

  5. Mico says:

    Jonathan,

    Thanks a million for this! It worked like a charm, and saved me from a major headache.

  6. Jonathan Moeller says:

    Glad it helped!

  7. Mercedes says:

    This post is just what I needed! I’ve had issues with Samba since I started using Linux, and I confess it’s because I was afraid to go near the config file for actually sharing. This wrote it up so clearly and easily that I knew exactly what to do, and it worked the first time!

    Thanks a bunch!!

  8. Chuk Lee says:

    I am trying to share a folder, but I want anyone on my network to be able to read and write it without getting a password challenge. What do I have to do to make it writeable by everyone?

  9. Pingback: newbie question - ssh tunnels, putty and sooo much more

  10. Pingback: Install the GIMP on Linux Mint 13 | Help Desk Screeds

  11. Tony Molski says:

    Great tutorial. I had a problem with the “sudo cp /etc/samba/smb.conf ~” command. It always said path not found on my computer. I actually had to go find the file in my computer, open it as root user, and put that text in that way. then the rest worked great. I cannot find it with my ps3 though, any idea’s on that??

  12. Helpful info. Fortunate me I found your site unintentionally, and I’m shocked why this coincidence didn’t came about in advance! I bookmarked it.