Tag Archives: sshfs

Windows 10 BASH: Tips and Tricks

I’ve been using the Windows 10 BASH shell for quite a while now forcing myself to get used to it. Along the way I’ve figured out a few working arounds for features such as sshfs and simple copy paste commands. First, the copy paste. When I first started using the Windows BASH shell I found it very frustrating when trying the copy and paste using the CTRL-C and CTRL-V commands. As any Linux user will tell you, these are kill commands and it doesn’t really make sense to use them. However, I did find another set of commands which work much better, here they are.

COPY: Select text, hit ENTER.
PASTE: Right click

So much easier than trying to fiddle with CTRL commands which are sometimes working and sometimes not.

Now let’s talk about sshfs, at the time of this writing FUSE support was not part of the Windows 10 BASH shell. There is/was however a petition to get it introduced, if it’s still not included and you would like to help, vote it up using the link below.

Windows 10 BASH FUSE Support

So, how did I get something similar to sshfs working, simple I put together a couple of shell scripts that utilize rsync and here’s the gist.  Basically what we want is a way to pull all the files we want to modify locally, use an editor to modify files and when the files are modified, push them back up to the server.  To do this, I created 3 BASH shell scripts named “pull”, “push” and “watcher”.  First the pull script, this script performs an incremental rsync pulling the remote files locally into a directory of your choosing.  The “pull” file looks like this:

rsync -au --progress user@someserver:/path/to/remote/directory /path/to/local/directory


The above requires that you pass change the “user@someserver” to your actual username and server name.  Also, the “/path/to/remote/directory” and “/path/to/local/directory” need to be changed to your specific files.  For my specific needs, I used something similar to the following:

root@myserver:/var/www/html/zf /mnt/c/Users/Jason/Documents/zf

You’ll noticed I have the end point of the rsync specified under the standard Windows file system, this is so I can use a native Windows editor (LightTable in my case) to edit the files.

Next, let’s look at the “push” file.  The “push” file looks like this:

rsync -au --progress /path/to/local/directory user@someserver:/path/to/remote/directory


The above is very similar to the “pull” file, just in reverse. This will do an incremental push only for files that have changed.

Lastely let’s look at the “watcher” file:

while ./pull && ./push;do : ;done


The above file continually attempts to do an incremental rsync push until you kill it (Ctrl-C). After you’ve customized the above files to your liking, all you need to do is execute a pull then execute the watcher, and you’ll have yourself a poor man’s sshfs.

user@computer:$ ./watcher


As an optimization approach, you can also add –exclude directives to the “pull” file which will ignore files and directories, for example:

rsync -au --progress --exclude .svn --exclude .git user@someserver:/path/to/remote/directory /path/to/local/directory

Edit Over SSH Using Any Locally Installed Editor

Ever find yourself needing to edit remotely over SSH and just wish you could use your favorite locally installed editor?  Yeah VI and EMACS are great, but sometimes don’t you just wish you could have your full workspace open without having to SCP/FTP files around.  Well, you can and here’s how you do it.

Mac/Linux Instructions:

Install the sshfs client according to your specific Linux version


root@computer:$ yum install sshfs


root@computer:$ apt-get install sshfs

Mac OS X

This command assumes that you have MacPorts installed. If you do not, install from here: Install MacPorts

user@computer:$ sudo port install sshfs


Next create a directory which will be used to access the remote files:

root@computer:$ mkdir remote_files


Finally mount the remote server and directory to our local directory “remote_files” replacing “username”, “remote-server” and “some-directory” with your real world values.  This syntax is very similar to that used by scp:

root@computer:$ sshfs username@remote-server:/some-directory remote_files


Assuming that the credentials supplied to the sshfs command were correct, you should now have a remotely mounted drive by the name of “remote_files”.

Now open your favorite editor and browse to “remote_files”, all your remote files are available to you as if they were local.  Code on!

Windows Instructions:

Begin by downloading win-sshfs at: https://code.google.com/p/win-sshfs/downloads/list

Install and be aware that a reboot may be required (you may want to bookmark this page so you can get back to it after the reboot).  You can just leave the default install options the way they are.

After it has been fully installed and your machine possibly rebooted, lauch wins-sshfs if it hasn’t been launched already.  Next click on the wins-sshfs icon in the task tray.

wins-ssh tray

Next you’ll be presented with a dialog, click the “Add” button and fill out the details of the remote server to connect to.  Ensure you select the correct Drive Letter to use for this remote connection.


Next click “Save”, then click “Mount”.

Assuming you didn’t have any credential errors you will have a newly mapped drive available to you.  Open your favorite editor and begin editing remote files on the drive like they are local.  Code On!