Fight for the Internet 1!

Saturday, February 21, 2009

SSHFS - Network Shares made easy with SSH

Overview

SSHFS is a program that can use the SSH connection on a computer for mounting a network share / network drive from that target machine to your local computer.

The great news is that you only need to install SSHFS on the computer which you are doing the mounting on, you do not need to change anything on the remote target computer. Put another way, if you want to mount your remote SSH machine's harddrive on your local desktop, you only need to install SSHFS onto your desktop. This is particularly convenient when you don't have administrator control over the remote target client and cannot install extra software.

SSHFS is running through an SSH connection (duh!), so your activity is as encrypted as your SSH connection is (which is pretty good if you use SSHv2, which you should be). SSHFS also inherents the permisssions of your SSH connection, so if you connect as a non-root user, you will be limited to the access that user account has.

Installing SSHFS

This guide assumes you can install SSHFS through your Linux distribution's package system (apt/yum/whatever).

For example, in Ubuntu/Debian:
sudo apt-get install sshfs

Preparing to run SSHFS

Make sure the 'fuse' module is loaded into your Linux kernel.
Check by running this command on a terminal:
lsmod | grep -i fuse
If you don't see it loaded, you can load the module with this command:
sudo modprobe fuse

Info on Mount Permissions

Mounting shares with SSHFS is like mounting devices in Linux. They require root/administrator level permissions to do, unless you have specifically changed it to otherwise.

Also, you need specific the permissions of the mounted shares when you mount them, or else your normal user account won't be able to read/write/execute anything in the shared directory.

To enable others to read/write/execute the shared directory, use the mounting command switch:

-o allow_other

You need to run the SSHFS commands as root or with the 'sudo' command.

The Dot '.' Special Character (convenient time saver)

Like the SCP command, SSHFS uses the '.' symbol as a quick way to write '/home/user' (substituting whatever username is invoked with the mount command).

Mounting Shares

The generalized format of the SSHFS mounting is this:

sshfs SSHFS_OPTIONS -p SSH_PORT SSH_USER@REMOTE_TARGET:. LOCAL_DIRECTORY

Here is an example line to mount an network share through SSH:
sshfs -o allow_other -p 7689 jon@192.168.0.10:. /home/jon/shares

In this case, the '.' is being translated into '/home/jon' on the remote target machine. This just saves time. You can explicitly mount other directories.

For example, the user 'bob' is logging in as 'jon' to the computer with the IP address 192.168.0.10, and is mounting that computer's /media/disk1 to his local directory 'shares' on his computer.
sshfs -o allow_other -p 7689 jon@192.168.0.10:/media/disk1 /home/bob/shares

SSHFS can be chain mounted if you desired, so you could mount from a mount from a mount over several SSH connections, but that would not only be ugly but probably slow.

Unmounting Shares

To disconnect a network share, you simply unmount it like any other device in Linux. This require the use of the umount command (not to be confused with 'unmount').
You need to run the 'umount' commands as root or with the 'sudo' command.

sudo umount /home/user/shares

You simply unmount whatever directory where you mounted the SSHFS connection to. Very simple.

Additional Information

SSHFS has several options you can set. Read the manual for more information.

A Word on Speed

SSHFS is pretty fast on local networks. I find their packets to have speeds that are always as fast as SMB/Samba packets. Over a remote network, it is hard to say but I find it is usable even on slow connections.

TROUBLE SHOOTING


SSHFS has only a few simple dependencies usually but your package manger should take care of those for you automatically. The only one it might miss is install the FUSE program.

If you cannot run SSHFS, try install the fuse-utilities.

Also, make sure you have the fuse module loaded into your kernel.

Make sure you are connecting to the correct remote target IP/Host.

Make sure you are using the correct login name for the remote target IP/Host.

Make sure you have permission to read/write/execute the target directory you are trying to mount locally.

Make sure the local target mount directory exists!

A word on SSH Public Keys

Mounting through SSHFS can give you cryptic/unusual errors if there is an error with SSH keys.

This is because of the layers of software it is translating through. In general, you will only see errors while mounting if you are connecting over SSH to a machine whose credentials don't meet expectations.

This typically happens if the remote target SSH machine's IP changes, or their SSH keys change on that machine.

You can confirm this is your problem by trying to connect via normal SSH to the remote target IP/Host. If you get a SSH key error, that is the source of your problem. You can edit your ~/.ssh/known_hosts file and delete the (entire) offending line.

But beware! If you get this error and you don't know why, LISTEN TO IT! SSH stores information on the IPs and the SSH keys it connects to. If the credentials don't match you might be under a Man-in-the-middle attack. So only modify your ~/.ssh/known_hosts file if you know the error message is not valid.

Afterward

The title of this post is "Network Shares made easy with SSH." Some of you might think is a lot of work to get a network share working. It is easier because, really, have you ever tried to get Samba shares working? :)

SSH for Windows

How to get SSH to work on Windows

We are going to use Cygwin's SSH package. Briefly, Cygwin is a Linux-like environment for Windows. It consists of two parts:
  • A collection of tools which provide Linux look and feel.
  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
Setup SSH in Windows

This guide should work for most Windows. It has been tested on Windows XP, 2000, and Vista.
  1. Download and install Cygwin. Note, if your selected download server is slow, try different one. There are good ones out there.
  2. When selecting the packages to install, make sure to include the following:
    SSH (Net/openssh).
    May also need zLib and TCP_Wrappers (both in Net).
    Be sure to install a good console text editor (Vim or Emacs or whatever).
  3. Set permissions for your SSH daemon configuration files.
    By default, Cygwin sets the file permissions to 600, so you cannot write to anything.
    To change this, you can set the group for the file, or set the permissions:
    chmod ago+w /etc/sshd_config
    or
    chgrp $USER /etc/sshd_config
  4. Next, open the file /etc/sshd_config in your text editor. Set the options as you like. I suggest a non-standard port in the thousands.
  5. Set permissions for HOST DENY/ALLOW configuration files
    By default, Cygwin sets the file permissions to 600, so you cannot write to anything. To change this, you can set the group for the file, or set the permissions:
    chmod ago+w /etc/host.allow
    or
    chgrp $USER /etc/host.allow
  6. Open the /etc/host.allow in a text editor. Make sure you allow sshd with something like this:
    sshd: ALL
    IMPORTANT: If you see a line that looks like:
    ALL : PARANOID : deny

    You MUST remove or comment-out that line.
    Save the file and close it.
  7. Restart SSH Daemon via 'services sshd restart'
  8. Firewall Configuration
    You need to enable an exception through the Windows Firewall for the SSH Port you are going to use.

    Control Panel -> Windows Firewall -> Exceptions : Add Port

    IMPORTANT: Make sure you ALLOW exceptions, as Windows frequently disables them in the firewall by default.

    You may also need to enable an network rule or exception in any other firewall software you use, such as Ghostwall or Zone Alarm.

TROUBLE SHOOTING

PATH Environmental Variables:

You may need to set your Windows PATH variable to include the cygwin executables.

Go to:
Control Panel -> System -> Advanced -> Environmental Variables.

Find the PATH variable and append c:\cygwnin\bin; or wherever you installed cygwin.

CYGWIN Environmental Variable:

Go to:
Control Panel -> System -> Advanced -> Environmental Variables.

Find the CYGWIN variable. If you cannot find it, create it.

Set the value to: ntsec tty

Wednesday, February 18, 2009

KDE 4.2 Review Continued

Abstract
My final thoughts and observations on KDE 4.2 before I switched back to KDE 3.5.

I have gone back to KDE 3.5. Thank God (or specifically Partimage) for ghost imaging because this would have taken me a lot longer to get back to "perfect working order" otherwise.

So I have used KDE 4.2 for about 12 hours no. Not a single crash yet, which I must say I am still very impressed with. Here are my final thoughts for the moment:

Better Bluetooth: I take it back what I said before. Their integration certainly is better but their program itself is still buggy. It keeps failing to recognize my keyboard after a reboot.

New Run Dialog: Very nice. A real improvement over what came before. Many individual programs are updated by their respective developers with new features (and taking advantage of many new things in KDE 4). The eye-candy, when I use it, seems nice but that's no surprise. Some new features are half-there, which look promising, particularly for Konquorer.

"Toggle Present Windows": This feature (keystroke CTRL+F9 by default) is really cool. This is a feature taken from Mac OS's dashboard and it is great. I am glad we have this in KDE by default now.

Desktop Backgrounds / Plasma: Despite their lack of tiling+scaling, I praise the KDE team for finally writing a good resampling algorithm for the desktop background display. Finally my pictures look good when scaled.

I have observed at least one image resizing bug with Plasma's desktop area. The image displayed without scaling (and it should have been scaled). I could not repeat it, and it was really a minor bug.

Show Desktop: I don't know if there is an option to "show desktop" in KDE 4 anymore. There is an option to show the Plasma desktop but since I'm not seeing my desktop background, it is missing one of my most important features.

The only thing I have found is adding a widget for this.

Widgets:
  • Show Desktop: There is a bug with this as it does not toggle all the time. It seems to work for 2 or 3 key-presses right in a row, then it stops working and leaves you on the desktop feebly pressing the shortcut key.
I may have mentioned that the Icons seem to be spotty (ugly or not working properly) in some situations but this is planned to be addressed in KDE 4.3.


Ark (zips, rar, 7zips, gzips, tars): The new Ark program for KDE is looking mighty fine. KDE has finally fixed their annoying bug with extracting multiple archives as once (it would often not extract all archives fully, only grabbing some of the files). Ark was in great need of an update even though I really appreciated the presence of Ark period. I remember what it was like in KDE before Ark appeared.

However I did manage to cause a "Fatal" error in Ark though it was the most graceful error I have ever seen in KDE 4. This happened when I told it "Extract to subfolder, name autodetected."

Konquorer:
  • Folder Tree Refresh: There is a bug with the Folder Tree view in Konqueror. It does not refresh and you can't manually refresh it without closing and reopening the application.
  • Renaming: So like I mentioned before, the rename file function in Konquorer has changed from an integrated view to a separate window. Now, at first I thought this was annoying because it was an unnecessary change and for a variety of reasons I thought it was an deprovement, not an improvement to Konquorer. But I lived with it. However, if you have malfunctioning Window Management Preferences (like I do now with Konquorer) then the tiny Rename window can fill your whole screen, becoming maximized. This just goes to show that separating the rename function into a different window was a thorough mistake.

Gwenview:

Before I begin talking about Gwenview's problem, I want to note that I am aware the Gwenview Developer(s) have stated that 1.4.2 is their stable version, not the version 2.2.0 that ships with KDE 4.x.

Gwenview Zooming:
This thing gets it own section.
  • Zooming: Zoom out on a large picture is not really a problem but enlarging a small picture looks bad. It appears that the older enlarging method applied a (Gaussian) blur of some kind after performing bilinear (or trilinear?) interpolation. I think this was nice and I miss it. The new images look very pixelated as they are enlarged.
  • The more I use Gwenview with this shitty zoom algorithm, the more I realize I can't stand it. It is horrible for reading comics with.
  • The subtle irony here is that while Gwenview had good zoom quality for years, KDE's desktop backgrounds did not. It seems this has reversed as now Gwenview has shitty shit zooming while KDE's desktop background looks nice.

Other problems with Gwenview:
  • Hotkeys / Shortcuts: A couple of options for assigning shortcut keys to are missing in the latest versions of Gwenview.
  • I forgot to mention that many (if not all) the plugins for Gwenview are not present in the Kubuntu early testing of KDE 4.2. I would venture a guess they are not available in other distros with KDE 4.2 either.
Good things with Gwenview:
  • Full Screen Interface: I like the new features that Gwenview has added, like a better full screen interface. Very nice for viewing multiple images in a row.

The Panel:
  • Task Switching with Mouse click: I noticed a bug with clicking from a grouped task to a non-grouped task. I hope that fix this bug.

Konsole:
  • Transparency again: By moving my konsole to a separate desktop where it is the only window, the Alpha-transparency basically acts like Good Transparency. This is a useable work around for getting good transparency back to my konsole but I don't deceive myself that I will probably have to seek a different konsole here soon enough. After using it for a few hours, this is really not bad but I wish I didn't have to do it.
  • Scheme switching: There is no quick and easy way to switch schemes in Konsole without going through a couple of menu items and clicking 3 buttons. I hope they fix this (by making it smooth like the old style).
So, after using KDE 4.2 for a while I can see that things are going to be great when they are finished. Even if they never added more features and just fixed the bugs, it would be a pretty stellar desktop-environment when all things are considered. However we all know KDE 4 will go for the gold, if you will, and achieve even greater greatness.

I look forward to KDE 4.3 that is scheduled (currently) for release in June.

Conclusion

If you are considering moving to KDE 4 and you use Konquorer, hold off until KDE 4.3 in June. Even if you don't, I would say hold off until more of the customization options are plugged into KDE 4 and several of those small but annoying bugs are fixed.

Draconian DRM in Windows 7

Nothing new here. Slashdot already reported it but it bears repeating.

So, surprisingly, I was getting my hopes up for Windows 7. From all that I had witnessed from my friends beta-installation, Windows 7 seemed to be pretty good. Sure, it was a straight rip off from KDE 60% of the time, and the other part it was a ripoff of Mac (which itself is a ripoff of KDE). Nonetheless, Windows 7 seemed to be better than Vista.... which is honestly not difficult to do.

But now, comes the new and even worse DRM measures being discovered in Windows 7. Thank you Microsoft, for making me realize just what freedom in the digital world is, and thank you further for making me once again happy to be using Linux.

Best quote from the original article:
"...but locking your own files away from you is a tactic so outrageous it may kill the OS for many persons"

http://tech.slashdot.org/article.pl?sid=09/02/16/2259257&from=rss

KDE 4.2 Review

Summary
KDE 4 right now is like using a nice Beta operating system. Well, not exactly. Your filesystem and kernel are not likely to crash. It should be noted that KDE 4.2 never crashed on me once, which is quite impressive. However there are still lots of features/customization options missing from KDE 4.2. The problems with Konquorer was the deal breaker for me, but at least everything else seemed usable for the time being.

The detailed breakdown....

I am spending a lot of time learning how to do the same old tricks in a new way. I'm really trying to hold back judgment because a lot of the ability to customize, which a core feature of KDE, is still missing. I won't be satisfied until it is there.

Now, I think KDE 4 is adding a lot of features that were needed. Better Bluetooth integration for one thing. EDIT: It is a little bug at the moment but when it works it will be nice.

The Problems and the Bugs....

QTCurve: There is a bug with using QTCurve for the Windows Style, which makes lots of black lines in Konquorer, which is too bad. I like that style.

Konsole:
  • Shortcut keys: The default shortcut keys in konsole interfere with real work. But you can change these through the Settings -> Configure Shortcuts menu. My case is CTRL+S, which locks my console. I have seen this behavior before but never from Konsole.
  • Transparency: Good transparency is gone from Konsole. I knew this had happened already and I need to find a good konsole now, but this needs to be stated: True-Alpha-Transparency is a tragedy because we are losing the "good transparency" in our programs. I have no use for this True-Alpha transparency and loath it with every fiber of my fibrously fibrous being. I want to see my desktop background in my semi-transparent console window, and I don't want to see the 20 windows below it.
  • Default Transparency: Ironically you have to open Konsole with a specific switch to enable transparency. Seriously? Lame.
KWin: There are bugs with not saving various preferences correctly. In particularly, I ran into problems with preferences for Konquorer. It was pretty annoying and attempting to delete the settings after they had been stored seemed to be impossible.

Konquorer :

(All the problems with Konquorer in KDE 4.2 is precisely why I hate Dolphin)
  • File Renaming: Changed to a separate window interface, not integrated into the current window interface. Doubtless this is because of Dolphin. Curse it.
  • Folder Tree: Many of options are missing from the right-click menu in the Folder Tree. For example, cannot rename folders by right-clicking; it can only be done in the right hand pane.
  • Configurations: A bug with Konquorer not saving configuration options, like showing tooltips or expandable folders. I hope they fix this soon.
  • Severe conflict between the detail view mode and the icon view mode. This is due to Konqurer stubbornly refusing to save my view settings correctly, if at all. I cannot enable previews in the icon mode and disable them in the detail mode.
  • Sizes of the icons are synchronized in all views. This is simply unusable. I need my icons to be large in Icon View mode and small in Detail view mode. Switching between Icon view and Detail view results in major pain because you will constantly be resizing your icons.
  • Gwenview integration is broken. I can no longer browse images quickly using the Space and Backspace keys in Konquorer. I am sure this will be fixed eventually, but I miss it.
  • 'media:/' protocol: Not there yet and I miss it, but it is planned for KDE 4.3.
  • Mouse gestures: These don't seem to work and the System Settings dialog for configuring them is just.... weird. The problem might be PEBKAC though.
Note on Konquorer:
Despite all the problems, I see some really nice stuff coming our way for Konquorer. The new buttons added to the toolbar menu are nice.

They finally fixed that really annoying bug with sporadic location bar position changes when using integrated Gwenview. I'm happy for that.

Konquorer's bugs were the last straw that made me switch back to KDE 3.5 but when those are fixed I think I can finally use KDE 4.xx.

Dolphin:
  • Tabs: Tabs now available in Dolphin. Makes me wonder how it is so different from Konquorer... on the surface anyway. I know underneath it is not a web-browser anymore.
  • Double Clicking: The Folder Tree view requires double clicking to use, not single clicking like it has been for generations. I hope that when this Folder Tree is ported to Konqueror (as the developers plan) they realize the need to improve this. I suspect they will.

Desktop Background: I am actually shocked and appalled that the Slideshow option is without features for scaling/tiling/positions. I was always saddened that KDE used an ugly resampling algorithm for their image scaling (shame on you guys), but this is ridiculous! I can only scale or title but not both! (All the other options are meaningless!).


The Panel:
  • The panel is fairly devoid of all the customizability that really matters.
  • No task grouping options. I have always hated Windows for offering to group my tasks together. I'm not a moron. I know what programs I have and I don't need you to group them. EDIT: I have discovered their is an option to not group specific programs, so they are obviously moving in the fully customized direction.
  • No task sorting options
  • No transparency configuration options. I do not know how to tell it to organize my tasks (or not organize them). Also, I don't know how to tell it to be "Elegant for Transparency" like back in 3.5. I miss that feature. Lets hope it comes back.

Application Menu:

The KDE team really should have put some thought into why Microshaft made their Vista startmenu and why they needed it.

The reason: Microshaft's program menu has no order, so people need help finding their applications.

The new style of KDE app menu takes more typing and more mouseclicks to access programs. It slows down the user for no good reason!! A hybrid system of the search-and-program-list would be nice. However a pure Vista knockoff is awful. Whoever thought this was a good idea for KDE should be ashamed at not thinking things through and blatantly following in the stupidity of Microshaft.
  • Most Recently Used Programs: This is a must have feature, and its not here. EDIT: This is already implemented in KDE 4.3, which does not surprise me and makes me happy.
  • Editing entries: You cannot edit application-menu entries by right-clicking on them and selecting "Edit this item." That activates the item. Instead, the only way to edit a menu entry is to right-click on the App Menu itself and select Menu Editor. Certainly not a deal killer, but a feature I miss when I'm setting up a new installation.

System Settings:
  • Empty Space: Several areas have lots of empty space, while their more advanced options are on other tabs. This just results in unnecessary clicking for me to reach my options again.
  • Colors: Creating custom color schemes is more laborious because what used to take 1-2 click now takes about 4-5. Very very annoying.
  • Some listings in configuration areas are not sorted by name... or by any logic I can see. One is the video section of the File Associations area.
  • Hard drives & File Systems: this configurae interface is missing. This is a critical thing for some people and I cannot BELIEVE that Kubuntu 8.10 shipped without it. It is not even there when I updated to KDE 4.2. Now, I know how to manually configure my own hard drives with Vim in a console, but I thought we were beyond those days guys? Come on! This is an F- grade.
  • Window Behavior: This is already semi-buggy as I mentioned in my tests with Konquorer, but they are planning to redesign and improve this interface by KDE 4.3. So for now we are just waiting.

Hot Keys:
  • Only One HotKey: Since when did KDE decide I can't have 2 hotkeys for the same feature/function/application? This is a mistake, but I suspect this bug will be fixed eventually.

Default Themes: Though I like the default themes of Wonton Soup and Obsidian Coast, both of these have problems. On webpages that need black-text on a white background, they too dark and fall under the perpetual problem we low-contrast users experience. Damn it. I had to recreate my own CDE theme from scratch. Slightly annoying. Not really KDE's fault unless you count lacking a greater variety of default available themes.


There is more to say but I don't feel like going on....

Conclusion
I'm giving up on KDE again this year. I have to find an alternative that works. I will probably switch to Ubuntu and toss KDE 3.5 back onto it.

KDE 4.xx has yet again wasted my time, sadly. I like some of the new things coming out in KDE but most of the functionality I need to use day to day is just not there right now.

Wednesday, February 11, 2009

Introduction

More than once I have wanted to make a blog to share some of the knowledge I have acquired pertaining to Linux.

I hope to publish some real content soon but for now I'm just registering a useful blog URL to have something nice for use in the future.

This blog will eventually contain information about Linux, various tips and stories involved with it, and also by proxy related information and tales about other Operating Systems, such as Windows.