We've moved!

TechKnack.blogspot.com has officially moved to TechKnack.net. You should be redirected in 3-5 seconds. Thank you.

April 16, 2008

Easy Linux-to-Windows File Sharing

Add this post to Del.icio.us. Del.icio.us (0 saved)

Samba has long been the defacto standard for accessing Windows file shares from Linux. However, there is also a Samba daemon (background service) that, if configured correctly, plays the reverse role -- sharing Linux directories to Windows machines. Unfortunately, proper setup requires you to edit the /etc/samba/smb.conf file, which, like most configuration files, can be rather cryptic.

Enter the GUI solution: system-config-samba. That's the package name in the Ubuntu universe repositories, I don't think the program itself has a proper name other than "Samba" (also check out the Fedora project wiki for the app). It's a sparse little app that gives you GUI access to the settings of the smb.conf file. Once you get the behind-the-scenes details set, though, adding shared directories is a snap.

First make sure you have samba installed (package "samba" in Ubuntu repos). Next, install the samba config package - "sudo aptitude install system-config-samba". The installation should put an entry called "Samba" in your Ubuntu menu (for me, using Kubuntu, it's under "Settings"). If you can't find it there, you can start it from a command line by running "system-config-samba &". Before the program starts, it will ask for your administrative password (same as your sudo password, unless you've changed something around).

Once at the main window, You can begin to appreciate how simple SCS makes configuration, using three main buttons that are very self-explanatory, along with a simple list of currently shared directories.

Before you start sharing, you'll want to setup the basic, general details. Open Preferences -> Server Settings. In the Basic tab, set your Workgroup (the default for Windows machines is usually "MSHOME" -- make sure all your computers use the same workgroup name, to avoid issues) and the computer description. In the Security tab, you set the sharing settings. For my home network, which sits behind a router, I use the "Share" authentication mode and set the guest account to my account, to allow open access to my shared directories. Once that's done, click OK. The program may seem to hang for a second or two - this is just the program restarting the Samba daemon for you, and happens everytime you change the settings for Samba or for a share. Next, setup a new share. I have a separate partition that contains all my music ripped from CDs. Within Kubuntu, I mount this partition as read-only, and remount it as read-write only when I need to modify the files (for example, add new rips or coverart). Here I'm sharing it to "everyone", read-only, under the name "music". Check out nixCraft for a quick rundown on Samba permissions.

If everything is right, you should now be able to access the Samba share from a Windows machine on the same network. I haven't tried this method for accessing the share from a Mac, but presumably you can use the same methods you would use for accessing a Windows share.

2 comments:

barra/.ponto said...

followed the link on lifehacker, however i couldn't read your blog because if i try changing the size of the font (ctrl'+' on firefox) it just breaks your layout horribly.
i copied, pasted on a odt file and am printing, so i can read. but please do something about your layout.

EterniCode said...

barra/.ponto -- you're right O_O Sorry about that.

I think I might completely redo the layout in stride with finding a UL-based layout (direct link).