Mounting remote directories over SSH from Windows, Linux and the mac.

Jul 29

I have a Linux server that I like very much. It’s at the hart of my home network and it houses all the data and projects I’m working on. My music collection, the podcasts I’ve downloaded, textfiles and scripts I’m working on and so forth.

The downside is that I don’t always have access to these files. I work on a variety of operating systems (A Windows laptop for work, A Mac for my creative splurges and a Linux workstation to fool around with). There are several solutions to “dail in” to your home network of course but somewhere I’ve found SSH to be one of the simplest ways to access remote machines, tunnel traffic and … access files.

Sometimes you want remote files to behave like local ones.

The problem is that sometimes you want to have your remote files and folders behave just like your local files and folders, without having to worry about vpn’s, netbios or FQDN names of certain files. You just want the data on your remote machine to act like data on your local one. Enter SSHFS.

SSHFS is based on SSH, a simple elegant and secure protocol that not only lets you connect to a remote server to run commands in a terminal environment, it’s also a pretty good poor-mans VPN you can tunnel all your tcraffic through (via SSHuttle). It’s also good to copy over files via secure ftp (with Filezilla for example). But copying files back and forth isn’t handy. You want real-time access to the juice man. Let’s get you fixed up and mount your remote linux folders, natively into your filesystem on Windows, Mac and Linux.

SSHFS on a Linux client.

SSHFS on Linux
On your Linux client you need to install sshfs
sudo apt instal sshfs

sudo apt instal sshfs

Then you create a directory on your local machine where you want to mound the files
Once installed you connect to your remote machine with the command

sshfs username@remotemachine:/directoryonremotemachine /directoryonlocalmachine

SSHFS from a MacOs client.

SSHFS on Mac
MacOs does not have sshfs capabilities by default but these can easily be installed via Brew
When brew is installed you can install sshfs with the brew command.
To mount your remote directory just use the same command as on Linux/

 brew install sshfs 
sshfs username@remotemachine:/directoryonremotemachine /directoryonlocalmachine

SSHFS from a Windows Machine

That also works but it does require a little more work to get it done AND Windows won’t let you mount to a folder nativey but points you to a driveletter instead.

First off install the following two applications:
sshfs-win
WinFsp

Next all you need to do is open a command line window and enter the following command.
net use .<yourdrive>: \sshfs\yourusename@remotehost….\directorystartingfromroot

 net use x: \sshfs\me@thedeathstar.empire....\deathstarplans R3belsRscumm 

In the end.

At the end of the day using SSHFS is a great way to quickly access files on a remote Linux system while having the files and folders integrated into the filestructure of whatever operating system you use. The additional encryption provided by SSH gives you good security. Both on Linux and on the mac you will be asked to authenticate with your password. If you don’t want to do that you setup ssh key exchange (see here) on how that is done. You can enter the commands in a script that you can just run (like a logon script).


Beware then when you are doing this on Windows your logon script might contain your login and your password for the remote system in clear text. So keep that somewhere safe.

Related Posts

KW1202 – One Linux to Rule Them All

Dec 08

Sometimes the way to achieve “less” is to make more use of the things you already have. If the thing you already have is a fairly powerful old laptop, what you may find is that it makes the perfect home server. This week Knightwise tells us all about the laptop with the new lease on life.

Credits

Episode produced by Keith Murray
Home screen picture courtesy of PixaBay

 

Related Posts


KW1105 60 Minutes of Common Sense

Aug 09

The knightwise.com podcast is back this week with a splash of cold water and a dose of plain old common sense. This week we talk about some strategies to keep you, your devices and your data out of nefarious hands. Vigilance, my friends.

Links

Music

Credits

Related Posts


Building a simple Offsite backup server with an EEEpc and Bittorrent Sync.

Jan 04

Some gadgets are just hard to throw out. Perhaps you keep hanging on to them because you have this plan of “using them someday” for “some project”. Perhaps you keep hanging on to them because of nostalgia. Whatever reason you might choose, those geeky gadgets that keep occupying that box in your office aren’t getting any younger. Why not put them to good use ?

Lets take 2 items in MY junk-box as an example. An aging Asus EEE 701 Netbook PC that I have been hanging onto because of sentimental reasons. (I smuggled it in from the US way before these babies were available in Belgium) Its keyboard is broken and its low specs when it comes to storage, memory and cpu power aren’t helping it in finding something useful to do these days. The second item is my first 1tb external hard drive. I haven’t thrown this one out because its on my ‘for-some-project-some-day’ list. Its been on the list for 2 years now … So lets smash them together and turn them into a Remote backup solution using open source software and Bittorrent technology.

1013636_10152730916287912_8486272877834744564_n

Step 1 : Turn the EEEpc into a headless server.

I downloaded the Image for Ubuntu’s ‘minimal installer’ off the net and have had it kicking around on an old USB stick for a while now. Because of its small footprint its ideal to do ‘light’ installations of Ubuntu because you can choose which components you want to install. I chose the ‘minimal Ubuntu server’ and the SSH server component. When the installation was complete I rebooted the laptop and hooked up the external USB drive (that I had formatted in one big FAT32 partition)

Step 2 : Install Webmin and mount the drive.

Because I was going to use my external hard drive to store my remote backups on (the EEEpc doesn’t have enough storage) I needed to be sure it was always mounted correctly if my little laptop should have to reboot. So instead of messing around with stuff like FStab config files I installed Webmin. (a Web-based interface to your Linux server). Using the ‘Disk and network file system’ menu I mounted the external drive into a folder called ‘backup drive’ that I had created in my home directory. This way I was sure that the external drive was always mounted correctly in the same folder.

Links : Howto install Webmin.

Step 3 : Install Bittorrent Sync.
Next up I installed a copy of Bittorrent Sync both on my local server and on the old eeePc. Following THIS tutorial lets you install Bittorrent Sync and configure the Web interface to be accessible from all over your network. (So make sure you choose a very secure administrator password). When installing Bittorrent sync this way, you are also sure the service always starts up when your computer reboots.

Links : Howto install Bittorrent sync. 

After the installation was complete I surfed to the Bittorrent web interface of my home server (source system) in one tab, and to that of my EEEpc (remote destination system) on another one.

Step 4 : Share a folder on your Source system.

Now it was pretty smooth sailing. On the Bittorrent web interface of my SOURCE machine I made a bittorrent share of each folder I wanted to backup remotely. I right clicked “properties” once the folder was created and copied the ‘READ ONLY’ secret.

Step 5 : Enter the key for the shared folder on your remote destination system.

Next up I went to the tab of my ‘remote destination system’ and entered the READ ONLY key. I selected a folder on my external drive where the files needed to be synced towards. (in my /home/backupdrive/ directory)

Step 6 : Do the initial copy

After repeating the process above for all the folders I wanted to ‘sync remotely’ I just had to wait for the initial copy to complete. After that it was time to pickup the EEEpc and the External drive and bring them to their new (remote) home. I hooked the EEEpc up to the network, started up the machine and … that was that … headless remote backup solution done.

Epilogue.

Because Bittorrent sync doesn’t care about open ports or anything I didn’t have to mess with the router on the remote end of my backup solution. There were no ports to forward and even a static IP was not required for the remote machine. Just connect it , fire it up and .. boom. Using the ‘read only’ secret is an insurance that changes to my files are only synced one way : From the source to the remote system (and never the other way around).

You can expand this setup (and increase the security at the remote end) by syncing over encrypted ZIP files. That way people can’t access the data should your system be compromised.

In the end its a great simple way to use an old system (you can even use an old laptop with a broken screen for this) and give it a new lease on life. The setup is simple, the interfaces are web based and the whole setup is perfect for a remote backup destination at your parents or in laws.

So secure your data and put those old clunkers back in action !

Related Posts

kw905 : Life on a Chromebook.

Jan 01


We deep dive into the world of Chromebooks and find an answer to the question : Can you survive on a Chromebook. We walk you through the possibilities and limitations of the Chromebook. We enlighten you  on how to use it for work, connect back to your home network and how to use your Chromebook to entertain you. If thats not enough we go beyond the design specifications and sideload Linux on your Chromebook turning into a low budget sliders dream machine. All of that and more .. in Kw905 : Life on a Chromebook. Catch the live recording of this podcast in the Youtube video below and see if you can catch Sulu the dog as our Podcast assistant.

Shownotes.

  • The Acer C730
  • First impressions
  • Hardware – Software
  • Taking the Chromebook to work (Article)
  • Using the Chromebook to entertain you (Article)
  • Connecting back to your home network via a Socks5 proxy over SSH (Article)
  • Dual Booting your Chromebook with Linux (Distroshare.com)
  • Sideloading your Chromebook with Crouton (Youtube instruction video)
  • Epilogue

Related Posts