When you’re using Linux, a popular way to share files with Windows is via Samba. For beginners, it can be a real pain to configure it manually, but with the right tool, it’s as easy as pie.
Way back in 2007, we showed you how to install Samba on Ubuntu. Things haven’t changed much, except that there are more ways to configure it. If you don’t have Samba installed and you aren’t afraid of the command-line, just follow the first step in that article and rejoin us here for the rest. If that’s a bit too intimidating, just scroll down.
Installing the Samba Config Tool
Since this guide is for beginners, why don’t we go through the Ubuntu Software Center? Open that up, and search for “samba” in the upper-right corner.
(Click screenshot for larger view.)
You’ll see a few different packages come up. The first one in our screenshot is the actual Samba package (above the highlighted one), called “SMB/CIFS file, print, and login server for Unix”. If you haven’t installed it yet, now is the time to do so. Just click on it and then click the Install button on the right that comes up.
For our tool, however, we want “Samba,” which is the highlighted software. Click on More Info to check it out.
(Click screenshot for larger view.)
You can see that the package name is “system-config-samba” and that means we’ve got the right one. Just click the Install button. I’ve already got it installed, so I have a “Remove” button in its place.
If you want to skip all of that and just use the command-line, here’s what you need to run:
sudo apt-get install system-config-samba
Once you’re all set up, you can add users and shares!
While Samba can work without user accounts (using a “guest” account), it’s best to be safe and enforce password-based use. Each Samba user will need a local account first. We’ve highlighted how to do this using the GUI in a previous article, How To Create a Family-Friendly Ubuntu Setup. You should also be able to do this quickly on the command-line, as outlined in Create a New User on Ubuntu Server 9.10 – don’t worry about the older version number, it still works the same way in Natty.
Once you’ve got local user accounts all set up, open up the Samba configuration tool from System > Administration > Samba and entering your root password when prompted.
Go to Preferences > Samba Users.
Here, you can add and delete users by clicking on the appropriate buttons. You can also manually change users’ passwords by clicking Edit User. It’s that easy!
Next, let’s change some server settings to suit our needs. Back at the main screen for our utility, click Preferences > Server Settings.
In the Basic tab, you can add your WIndows Workgroup name and a description for the Samba server.
In the Security tab, we strongly recommend you use User Authentication Mode, as this will allow or disallow shares based on your configured Samba users. We also strongly recommend you encrypt your passwords and disable the guest account. When you’re done, click OK.
To add a share, just click the green plus sign on the tool’s main window, or go to File > Add Share.
Type in the directory you want to share, or click Browse to navigate to it with the mouse. Enter the shared folder’s name and a description. You can leave the share as read-only, or click the check-box to make it writable. You’ll probably also want to make it visible, so you can navigate to it properly on Windows machines from your network.
Under the Access tab, you can manually specify users who have access to this share, or you can allow everyone to access it. If you choose “Allow access to everyone” but you specified that user authentication was required from Server Settings, users will still need a valid account and password on this system to access those shares. To add more shared locations, lather, rinse and repeat!
Setting up Samba on a home Linux server is an ideal way to let everyone share files quickly, easily, and securely inside your home network. Macs won’t be left out, either, as a matter of fact, and everyone can rest easy knowing that it’s simple to manage.
Do you have a preferred setup for Samba? Do you user something else instead? Share your thoughts below!
- Published 09/16/11