Welcome to edgylogic, drive:activated visitors. This is my new home on the net.


  • Access *nix on Windows as if it were a local drive

    Wow, its been a long time since I last posted. I blame uni assignments, way too many 21sts (including my own), and my own desire to sleep way more than I ever need. There are quite a few posts I've been meaning to write, so fingers-crossed posts will be a tad more frequent for the next while. But I did say posts will be somewhat sporadic, didn't I? Smile

    One of the assignments I've had to do this semester involved writing a website in PHP (ick, but I digress). It had to work on the uni server for assessment, and the suggestion was that we should download something like XAMPP, develop on our own computers, then when we're done, upload to the uni server (running Solaris) and debug all over again (due to potential differences in PHP version - PHP seems to change syntax with every release - and PHP settings).

    That seemed pointless - why develop on a different machine, when it has to fit the constraints of another, whose configuration is not fully known (the development to staging to production server argument doesn't apply here). Why don't we just develop on the uni server? One way to do that is to upload the changed files every time we made a change, but that was tedious and boring.

    I knew you could mount another *nix system on Linux thanks to FUSE and SSH/SCP, so I set about finding a similar solution on Windows, which would let me mount a *nix system as if it were a local drive.

    Enter the Dokan library and DokanSSHFS.

    The library is effectively an implementation of the Linux FUSE concept on Windows, making it easier for developers to create drives on Windows that interacted with something else. DokanSSHFS builds on the Dokan library and allows you to mount your *nix system as a drive on Windows. You can browse through all the files, create new ones, delete, modify... everything you can do with a local drive. Most programs will work with it, as it is exposed as a standard drive. As a bonus, you can even modify *nix file permissions right from the properties dialog.

    There are a few steps to get this working, but if you do anything that requires constant transferring between *nix and Windows machines, this is a lifesaver. You do need to be using Windows XP or Vista (or the server equivalents I assume), and the *nix server needs to have SSH enabled and running.

    1. Download the Dokan Library. It is available from here http://dokan-dev.net/en/download/ - first link after the Dokan library header; download the version appropriate to your computer's architecture; do not download the source.
    2. Unzip it, and run the MSI file inside to install it. The installer might open the installation folder during the installation process; just close it when the install is done.
    3. Check that you have Microsoft .NET Framework 2.0 installed. If you have Vista, you already have it installed. If you are running XP, check your Add/Remove Programs dialog in the Control Panel for it. If you have any of the later versions installed (e.g. 3.0 or 3.5), you have it. Otherwise, download it from http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en.
    4. Download and install this (unless you are sure you have it) - http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en
    5. Download Dokan SSHFS. It is available here http://dokan-dev.net/en/download/ - first link under the Dokan SSHFS header.
    6. Unzip Dokan SSHFS and double-click the MSI file inside to install. The installer might open the installation folder during the installation process; just close it when the install is done.
    7. Once that is done, you will have an icon on your desktop (and start menu) named DokanSSHFS. Double-click on it.
    8. When it has loaded, you need to enter in the details for your *nix server. It should be fairly self-explanatory.

      For Server Root, this is the folder on the server that you want mounted as the root when navigating on Windows. So if you enter in /, when you navigate to your SSHFS drive, you will get all the standard *nix root folders, e.g. home, etc, bin, usr. If you enter in /home/yourusername/ though, then when you navigate to your SSHFS drive, you will get your home folder's contents instead. You will not be able to navigate upwards to any parent folder, e.g. /etc, in this case.

      For drive, you need to select a drive letter that doesn't currently exist (Z drive is usually a safe bet). It usually automatically picks the next unused one anyway.

    9. Give it a name up the top and click save so you don't have to type the details in each time.
    10. Click Connect.
    11. When it has connected, a dialog will pop up saying 'sshfs start'. Click ok.
    12. Open up My Computer, and you'll see a new drive there, named DOKAN with the drive letter you specified earlier. Double-click it, and voila! there's your *nix server.

    When you're done, right-click on the SSH icon in your system tray and click Exit to close the connection and unmount the drive.

    To start the connection next time, start with step 7 onwards, ignoring step 8 and 9, although you will need to enter your password.

    At the time of writing, there are a few issues with it - make sure your internet connection is fairly solid, otherwise you will encounter errors when trying to save files back to the *nix server. Also some programs don't seem to work very well with it, but on the whole, it generally works quite well as it is just exposed as a standard drive.

    If you're on a Mac, your life is a bit easier - check out http://www.macfusionapp.org/about.html. That's the easy part. You'll also need some bits from http://code.google.com/p/macfuse/. Download the MacFUSE download first and install it, then follow the instructions here - http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS.



New comments have been disabled for this post.

If you have something to ask about this post, drop me a message.