Sharing files and printers with Samba

Samba allows Linux and Windows computers on the same workgroup to share files and devices such as printers.

Samba configuration will be illustrated by a practical example. First we will configure the Windows computer(s) to join a local workgroup, and to share files and devices. Then we will install and configure a Samba server on Linux to facilitate the shares and to share the printers connected to it. Finally, we will configure the Windows computer(s) to access the printers connected to the Linux box.

These notes assume a working local network. The computers in this example are Windows XP and Mandriva Linux 2009.1, but the basic concepts should be generally applicable.

TODO: These notes are a work in progress. I was able to get far enough to share printers but not files. Since printer sharing was my only immediate objective, I stopped at this point. I still need to figure out file sharing. I also need to rewrite these notes to make them more generally useful: complete and check my translations into English of the original Spanish text in Windows, make the Linux instructions less Mandriva-centric, etc..

ON THE WINDOWS BOX
1. Name the computer. On Windows XP, right-click on My PC, select Properties, and enter the tab “Computer Name”. On Windows 7, go to Control Panel – System and Security – System, and in the section “Configuration of Computer’s Name, Domain, and Workgroup”, click on “Change configuration”. Give the workstation a name if it does not have one. A name should be unique to the local network, contain only lower case alphanumeric characters or dashes. Avoid beginning or ending the name with a dash, or using upper case letters.

2. Join a workgroup. Find “To change the name of this computer or join a domain…” and click on the “Change” button. Under “Member of” select “Workgroup” and enter the workgroup name. Samba gurus suggest that numeric names are best (e.g. “2009”) in order to avoid case problems. Press “Accept”. Reboot the computer.

3. Check your work: In the file explorer, drill to Network Neighborhood – Entire Network – Microsoft Windows Network. You should see the workgroup name; open it. The workstation should see itself; if it does not, stop and fix Windows networking before continuing.

4. Share folders and devices: In the file explorer, right-click a folder you wish to share (e.g. C:\Documents and Settings\user\My Documents). In Windows XP, select “Share and Security”; in Seven, select “Share”. In the tab “Share”, section “Uso compartido y seguridad de red”, select “Share this folder on the network” and “Permit network users to change my files”. Press “Accept”. Insure that the icon for the shared folder now displays a hand underneath it, indicating that it is shared. Repeat this for every folder and device you wish to share.

5. If you have more than one Windows computer to interconnect in the workgroup, repeat steps 1-4 for each computer. In step 3, insure each computer can see not only itself but each other computer and its respective shares. Again, if this does not work, stop and fix Windows networking before continuing.

ON THE LINUX BOX
1. On the Linux box, open the Mandriva Control Center (MCC) – Network Sharing – Share drives and directories with Windows (SMB) systems. If samba-server is not installed, you will be prompted to install it, then walked through the samba wizard. Consider installing the samba-doc package as well. Follow the wizard’s on-screen instructions. Choose default settings unless you have reason to use something else. However, Samba gurus recommend:

  • Use share rather than the default user security mode
  • Remove variables from the welcome message

2. Once configured with the wizard, DrakSamba will open; here you manage your Samba server. Default settings for file share and printers are usually good. In users, add at least one user. This user should also exist on each Windows machine.

TODO: Confirm that user names match case. Must they have the same passwords on every computer? If the workgroup contains more than two computers, must every computer have the same user/password combination, or is it sufficient that each Linux-Windows pair have matching user/passwords?

Select File – Write conf, then Samba Server – Restart.

3. TODO: What next on Linux? Once set up, things should be easy and intuitive for the user (e.g. shares automatically detected, authorized, and mounted).

  • urpmi smb4k; configure?
  • MCC – Network Sharing – Access Windows (SMB) shared drives and directories?
  • Dolphin – network?
  • urpmi samba-swat?

BACK ON THE WINDOWS BOX
In Control Panel – Printers and Faxes, open “Add a printer”. The New Printer Wizard will launch; follow its instructions to add a printer connected to the Linux box. When finished, print a test page to confirm that all is well.

Repeat the above for each printer connected to the Linux box. Then repeat on each Windows box.

TEST
Reboot all machines and ensure that all works as desired.

REFERENCES
GUI Tools
There are numerous GUI tools to configure and use Samba. Those I’ve looked at include:

Configuration tools

  • Webmin. Samba tools are found in Webmin at Servers – Samba Windows File Sharing. This is a tool for experienced Samba administrators who know what they are doing.
  • Swat. Swat does not support HTTPS, so it should only be used locally and on trusted networks. I haven’t found anything that Swat does better than Webmin.

End user tools

  • Dolphin (KDE 4) and Konqueror (KDE 3)
  • Nautilus (Gnome 2)
  • Smb4K (KDE)
  • xSMBrowser (GTK)
Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

One Response to Sharing files and printers with Samba

  1. Pingback: Internet sharing on Linux | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s