Network Transparency with KIO
Kioslaves are out-of-process protocol handling plugins that let you access various services as though they were part of your local filesystem. They can be accessed through the Konqueror file manager and any standard file dialog in most KDE applications. The applications using Kio don't need to be aware of how to access the remote host or device—the ioslave handles it all. This provides powerful and flexible network transparency for KDE applications.
KDE includes a large range of basic kioslaves. Some KDE add-on applications install their own. You can add new kioslaves at any time, and all KDE KIO-aware applications will work with them. If you use Konqueror as a Web browser, you're already using KIO, as the HTTP, HTTPS and FTP protocols are implemented as kioslaves.
The KDE fish kioslave provides a graphical interface for manipulating files over Secure SHell (SSH). Fish should work with any POSIX-compliant UNIX providing it has a Bourne-compatible shell as /bin/sh and basic file manipulation utilities like cat, chgrp, chmod, chown, cp, dd, env, expr, grep, ls, mkdir, mv, rm, rmdir, sed and wc. If Perl is available, it is used instead. In that case, only env and /bin/sh are needed out of the list above, and using Perl has the advantage of being much faster. I've used fish to log in to Linux, FreeBSD, Mac OS X and Solaris with equal success.
Most of what is discussed in this article holds true of the ftp and sftp kioslaves as well, which present much the same interface to the user.
Here, I'd like to use fish to log in to my Apple Macintosh computer to grab some files and copy them locally. Because it's running a variant of UNIX with env and Perl and has sshd running, fish will work with it just fine. To log in to a remote host, type:
into the Konqueror address bar. If your remote sshd is listening on a custom port, you can specify this at the end of the URL:
If this is the first time you've tried to connect to this host over SSH, Konqueror brings up a dialog noting that it cannot verify the authenticity of the host and asks for your input to proceed. Select Yes to indicate that you want to continue connecting to this host. SSH then caches the fingerprint of this host in your ~/.ssh/known_hosts file.
Unless you have SSH keys set up for passwordless login, Konqueror shows a dialog asking you to enter your password. Ticking the box Keep password saves the password into your KWallet. This can be very convenient if you plan to access this host often.
Now I'm logged in and looking at my home directory on the remote host. I need to find the image I want out of the image files stored here. With the size of my digital photograph library, none of the images are named descriptively, and unfortunately, without being able to look at the images, I really have no idea which is the one I want.
One of the areas where fish really shines is the way it lets you preview remote files in much the same way you would preview local ones. KDE's preview mechanism is flexible and powerful, enabling you to see previews of images, PDF files, fonts and office documents as well as listen to previews of audio files.
To enable previews over fish, select Configure Konqueror... from the Konqueror Settings menu. Navigate to Previews & Meta-Data in the dialog that appears. Under Internet Protocols, tick the box next to fish. Adjust the slider beneath Maximum file size to a sane value for the speed of the connection you're using. If you're accessing hosts over the Internet, you probably don't want Konqueror to attempt to generate thumbnail images of 100MB TIFF files. Click OK and you're done.
To fine-tune exactly the specific file types for which you want to see previews, look under Preview in the View menu. Here you can enable various file types for showing previews, and also quickly toggle between enabling and disabling previews globally. If you had a Konqueror window open while adjusting these settings, you may need to click reload before you see any changes.
Now I can see previews of my images, and I've found the one I want. I can drag and drop it to an open Krita window for editing and save my changes afterward directly to the remote host. Or, I simply could copy the file locally for further processing, also using drag and drop.
Fish lends itself well to the simple maintenance of remote Web sites. Tasks like moving, renaming and changing permissions on remote files are easy when you approach them from Konqueror's familiar file management interface.
Changing permissions for files on a Web server is a common task. Often the default permissions on files created on your Linux box can be too restrictive and result in a Forbidden error message when people try to access the files over the Web. To change the permissions of a file over fish, right-click on the file and select Properties. On the Permissions tab choose Can read for both Group and Other permissions, and click OK. If you were changing permissions for a CGI, you also would tick the box labeled is executable.
In KDE 3.5, Kate gained the ability to save a working set of documents as a session to be resumed easily again later. When coupled with fish, this makes, for me at least, the ultimate Web development environment.
To open up all of the HTML, CSS and other files associated with my Web site in Kate, I can drag and drop them from an open Konqueror window showing me a fish session to the remote host. Dragging and dropping multiple files in this way causes them to be opened as separate files that I can navigate between in the Documents pane.
If you prefer to use a more GUI-oriented Web development tool rather than editing files manually in Kate, the full-featured integrated Web development environment, Quanta Plus, is also KIO-enabled.
You can use the File→Open dialog to take advantage of KIO network transparency. All standard KDE file dialogs have support for kioslaves. To load files over fish, select Open from the File menu. In the location bar at the top of the file dialog, type your fish URL:
Navigate to where the files associated with your Web site or where other projects are kept, and open the files you want to be a part of the session. To open multiple files at once, hold down the Ctrl key and click once on each file you want to open. When you're finished selecting files, click Open.
If you plan to access this remote host often, you can add a shortcut to the icon bar on the left of the dialog. Choose the directory to which you want the shortcut to point, and drag it to the icon bar. You can edit the name, icon and other attributes of this shortcut by right-clicking on it and selecting Edit Entry.
Once Kate has loaded the files you want to save as a session, select Save As from the Sessions menu. Enter a name for your new session—as I'm saving various files relating to my Web site, I call my session canllaith.org.
In the future, when you want to load this set of remote files quickly, you can choose the saved session from the Sessions menu. I use this tool time and time again. At the end of a day of working on a Web site and opening various remote files from all over the directory tree, I simply save them as a session with the date and a short descriptive name. Next time, remembering where I left off and what files I was working on is a little bit easier.
Editorial Advisory Panel
Thank you to our 2014 Editorial Advisors!
- Jeff Parent
- Brad Baillio
- Nick Baronian
- Steve Case
- Chadalavada Kalyana
- Caleb Cullen
- Keir Davis
- Michael Eager
- Nick Faltys
- Dennis Frey
- Philip Jacob
- Jay Kruizenga
- Steve Marquez
- Dave McAllister
- Craig Oda
- Mike Roberts
- Chris Stark
- Patrick Swartz
- David Lynch
- Alicia Gibb
- Thomas Quinlan
- Carson McDonald
- Kristen Shoemaker
- Charnell Luchich
- James Walker
- Victor Gregorio
- Hari Boukis
- Brian Conner
- David Lane