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 OpenOffice.org'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 OpenOffice.org 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
make
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é (mggagne@salmar.com) 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.

______________________

Comments

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'."

Nigel

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 libsmbclient.so (installed to /usr/local/samba/lib/ by make install of samba from source) was symlinked from /usr/lib/

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

H

Thanks.

weber's picture

libsmbclient.so.0 was not found in my case.

# locate kio_smb.so
/usr/lib/kde3/kio_smb.so
# ldd /usr/lib/kde3/kio_smb.so|grep 'not f'
libsmbclient.so.0 => 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.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState