Cooking with Linux - It's a Cross Platform, All Right!

Linux-based file managers make it easy to use files and printers on your legacy Microsoft Windows systems.

Yes, I admit it, François. That's very funny. When I told you that this month's theme was cross-platform development, I didn't mean platforms that make you cross, although I can understand thinking of some OSes as cross platforms. As amusing as those images are, I think the artwork you chose for the menus tonight might raise a few eyebrows, despite our, shall we say, sympathetic audience.

Speaking of which, I see that our guests have arrived. Welcome, mes amis, to Chez Marcel, home of exceptional Linux fare, one of the world's greatest wine cellars and the greatest customers in the world. Make yourselves comfortable. François and I were discussing the theme of this month's issue, cross-platform development, and my waiter was getting a little rambunctious. It almost seems as though we should bring out a white Zinfandel for this, but luckily, we have none in stock. François, to the cellar, immédiatement! Bring up the 1992 Napa Valley Cabernet Sauvignon. Vite!

As many of you know, Microsoft Windows remains a part of the average business IT department. Many of us must be able to exchange information between Windows and Linux. For example, somehow you convinced management to let you run Linux on your workstations instead of Windows. Maybe you are using your own notebook. Whatever the reason, you now are going to have to deal with the Windows workgroup or domain and the appropriate shared files and printers. Although Jon in accounting isn't particularly fond of his Windows XP box, many important files are shared from that machine, files that are shared in the network neighborhood.

You might ask yourself how easy it is to take advantage of the network neighborhood. This is an interesting question considering how many file and print servers out there aren't running Windows but Linux, providing the file sharing experience through Samba. Consequently, it isn't surprising that Samba-compatible client software tends to come as part of the standard installation on most modern Linux distributions. What that means is you can connect to a Windows share on the network using the smbclient program, started with smbclient -L sedna, which would produce a report of shares that looks something like this:

Domain=[ACCOUNTING] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Sharename      Type      Comment
        ---------      ----      -------
        SEDNA_C        Disk
        IPC$           IPC       Remote IPC
        Reports        Disk
        Policies       Disk

Assuming you had permission to view the Reports folder, you could connect to it like this:

smbclient //sedna/reports -U winuser

In the above example, I am connecting to a Windows XP box from my Linux workstation as user winuser. The system then asks me for a password, after which I am taken to a Samba prompt that looks like this:

Domain=[ACCOUNTING] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \>

From there, type help and smbclient offers up a list of all the things you can do while connected using the commands at your disposal. A number of them are obvious things, such as dir, copy and so on. Although all of this is good, it's not pretty in the graphical sense and you can't use this while working in your graphical file managers or inside's applications.

Whether you are using KDE or GNOME as your desktop environment, rest assured that all the tools you need to join the network neighborhood are right there at your disposal. Best of all, it's extremely easy to do. Let's start by taking a look at Konqueror.

Open up Konqueror (either as the file manager or the browser) and type smb:/ in the Location field.

Samba servers or Windows machines advertising network shares first appear in the browser window under their workgroup name (for example, ACCOUNTING, SALESGRP). Figure 1 shows a Konqueror session with a two-panel view; click Window on the menubar and select Split View, Left/Right. In the left panel, we have the basic network browser view with three active workgroups. In the right-hand panel, I've clicked on the ACCOUNTING workgroup to show the computers belonging to that group.

Figure 1. Using Konqueror to Browse Workgroups

To read, write or otherwise make use of the files shared on those computers, double-click on the corresponding folder for that computer—François' computer for instance. All of the available shared directories (or folders) then are visible (Figure 2).

Figure 2. Once connected, browsing is basic file manager navigation.

From here, it's all classic drag and drop, graphical file manager browsing. By clicking (or double-clicking, depending on the configuration), I can go inside the cooking folder, locate the appropriate document and open it with Writer if I choose. (Right-click on the file, select Open with and voilà, I'm editing a document on a shared Windows resource.)

Ideally, we don't want to go through this whole navigation process each and every time. To bring a given network share a few clicks closer, simply bookmark the appropriate shared folder.

Over on the GNOME side of things, we have Nautilus. You should find the process similar to what we went through with Konqueror. Start Nautilus and type smb:/// in the Location bar. Nautilus then displays the active workgroups on the network (Figure 3).

Figure 3. Nautilus in SMB Network Browse Mode

From there, you can double-click on one of the workgroups to select a computer. Then, from the list of computers, double-click on your choice, and you can browse the individual resources offered (Figure 4). Be aware that when you move around from computer to computer like this, you occasionally may be asked for a user name and password for that computer or even the specific folder.

Figure 4. Windows and Samba shares are accessed easily.

As with the Konqueror example before this, you can save yourself a little time by bookmarking the folder of your choice. The problem with both of the suggestions I've made is that neither of them lets you permanently mount network drives. Accessing a particular folder requires that you do a little command-line work, an easy enough process but not quite the point-and-click ease that Windows users on your network want to see. Let's have François refill our glasses while we take a look at a way to solve this dilemma.

For a more robust and flexible means of working in and with the network neighborhood, you simply must take a look at Smb4K, a super-classy SMB browser tool that also is flexible and powerful. Furthermore, Smb4K makes it possible to preview shares, mount shares locally without needing to run as root, reconnect automatically on startup and more.

At the time of this writing, Smb4K was sitting at the 0.3.2 release, but I found it to be a capable package and definitely worth the time it takes to investigate. Binary packages for Debian, SuSE and Fedora are available from the site, as is the full source. Building Smb4K from source is as easy as the classic extract and build five-step:

tar -xzvf smb4k-0.3.2.tar.gz
cd smb4k-0.3.2
./configure --prefix=/usr
su -c "make install"

When you have installed the package, run the program by calling smb4k. As soon as you start Smb4K, it scans the network looking for active shares. You can fine-tune its functionality, including such options as whether you want shares to be reconnected automatically by clicking on Settings in the menubar and selecting Configure Smb4K. The graphical interface is intuitive and easy to navigate, and the package as a whole is easy to use.

The display is divided into a left-hand side navigation panel where workgroups, computers and shares can be listed and navigated. To mount a share, right-click on it and select mount. If you would rather see what you are getting into first, choose Preview instead.

Figure 5. Smb4K: could this be the ultimate SMB browser?

Mounted drives appear in the top right-hand window as drive icons. Double-clicking on one of the drive icons calls Konqueror. If you run df from the command line, you see that the drives now are mounted for your use in your own home directory under an Smb4K directory prefix. For instance, for the example in Figure 5, the listing looks like this:

Filesystem       Size Used Avail Use% Mounted on
//SEDNA/Reports  4.0G 3.0G  1.1G  75% /home/marcel/smb4k/SEDNA/Reports
//FRANCOIS/wine   13G 8.8G  3.3G  73% /home/marcel/smb4k/FRANCOIS/wine

Now, any of my applications—whether KDE, GNOME, shell-based or anything else—can access the shares. Being part of the neighborhood has never been easier.

Mon Dieu, mes amis, closing time has come so quickly. François, would you be so kind as to refill our guests' glasses a final time? We certainly don't want anyone going home cross, and with the items on today's menu, the neighborhood's doors all are open to you. Until next time, mes amis, let us all drink to one another's health. A v�re sant� Bon app�it!

Resources for this article: /article/7548.

Marcel Gagné ( lives in Mississauga, Ontario. He is the author of Moving to Linux: Kiss the Blue Screen of Death Goodbye! (ISBN 0-321-15998-5) from Addison Wesley. His first book is the highly acclaimed Linux System Administration: A User's Guide (ISBN 0-201-71934-7). In real life, he is president of Salmar Consulting, Inc., a systems integration and network consulting firm.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Samba 3.x

Anonymous's picture

SMB4K Not work in samba 3.x correctly...

Re: Samba 3.x

Anonymous's picture

Yes it does. I'm Using version 3.0.2a Mandrake 10 works perfectly

Re: It's a Cross Platform, All Right!

Anonymous's picture

The date on this article is Thursday, July 01, 2004
we are only June 10

An error occurred while loading smb:/

nigelp's picture

I make quite a lot of use of smbclient from the command line so I was very pleased to see this article. However, when I tried out his first suggestion of using konqueror to join my network neighbourhood I got this message when I typed smb:/ into the Location field. I've googled this error message but not really got anything useful. I am using Konqueror 3.1.1 on KDE 3.1.5 and Kernel 2.2.20.

"An error occured while loading smb:/:
Could not start process Unable to create io-slave:
klauncher said: Error loading 'kio_smb'."



Anonymous's picture

i had to install samba and openldap-client.
After that Konqueror could brows via smb:/

solved on my system by

Anonymous's picture

solved on my system by ensuring that (installed to /usr/local/samba/lib/ by make install of samba from source) was symlinked from /usr/lib/

ldd of was how I figured it out - there was a dynamic link dependency reporting "Not found".
Needed a symlink as btw.



weber's picture was not found in my case.

# locate
# ldd /usr/lib/kde3/|grep 'not f' => not found
# yum -y install libsmbclient

Check that you have kio_smb i

Anonymous's picture

Check that you have kio_smb io-slave. There was reported an error with samba 3.0.8, that kdebase would not compile samba support. The same happens if you do not have samba on your system.

Re: An error occurred while loading smb:/

Anonymous's picture

Could it be that you need another slash (/) at the end of the line? eg: smb://

Re: An error occurred while loading smb:/

Anonymous's picture

I'd suggest that you would upgrade your KDE setup, it's quite old.

It's possible, that your samba libraries (libsmb) are not compatible with kio_smb -ioslave.

Free Dummies Books
Continuous Engineering


  • What continuous engineering is
  • How to continuously improve complex product designs
  • How to anticipate and respond to markets and clients
  • How to get the most out of your engineering resources

Get your free book now

Sponsored by IBM

Free Dummies Books
Service Virtualization

Learn to:

  • Define service virtualization
  • Select the most beneficial services to virtualize
  • Improve your traditional approach to testing
  • Deliver higher-quality software faster

Get your free book now

Sponsored by IBM