Files
hpr-knowledge-base/hpr_transcripts/hpr1944.txt

204 lines
22 KiB
Plaintext
Raw Normal View History

Episode: 1944
Title: HPR1944: sshfs - Secure SHell FileSystem
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1944/hpr1944.mp3
Transcribed: 2025-10-18 11:36:49
---
This is HPR Episode 1944 entitled S.S.H.F.S Secure S.H.F.I.L. system.
It is hosted by 5150 and is about 31 minutes long.
The summary is how to mount remote storage using S.S.H.F.S.
This episode of HPR is brought to you by an honesthost.com.
Get 15% discount on all shared hosting with the offer code HPR15.
That's HPR15.
Better web hosting that's honest and fair at An honesthost.com.
Howdy folks, this is 5150 for Hacker Public Radio and the day I'm going to deal with
a topic Ken Fallon has been trying to get someone to speak on for years now.
That's S.S.H.F.S. The Secure S.S.H.F.I.L.F.I.L. system.
I've long been a user of S.S.H.H. but I haven't.
I've declined to do the show because I thought well you can't just start there.
You've got to deal with the whole topic of S.S.H.H.
So I always looked at it as a series of shows and thus never got started on it.
Now fortunately in the past couple months other hosts have come on and give us a pretty good foundation in S.S.H.
So I can do the S.S.H.F.S. as pretty much a standalone show.
Now I'm going to start by reading from the top of the man page for S.S.H.F.S.
Again which stands for Secure Shell File System and it says it's a file system for Linux
and other operating systems with a few implementations such as Mac OS X or free S.B.
Capable of operating on files on our remote computer using just a Secure Shell log in on our remote computer.
On the local computer where the S.S.H.F.S. is mounted the implementation makes use of the fuse or file system in user space, kernel module.
The practical effect of this is that the end user can seamlessly interact with remote files being securely served over S.S.H.
Just as if they were local files on his slash her computer.
On the remote computer the S.S.S.F.T.P subsystem of S.S.H. is used.
In short it's my opinion that S.S.H. offers a dead simple way of mounting remote network volumes from another system on a specified mount point on your local host with the added benefit of encrypted data communications.
It's perfect for ad hoc connections on mobile computers or for more permanent links.
This tutorial is going to be about how I use S.S.H.F.S.
I'm not going to delve into every conceivable argument that can be used with S.S.H.F.S.
because most of them I haven't used myself and all I would be doing is essentially reading the man page and probably interpreting it poorly.
I think what I do with S.S.H.F.S. is going to cover the vast majority of use cases.
And so we'll just stick to what I'm doing so we don't make things too complicated.
There are other ways to mount storage, most notably Samba.
But unless you're trying to connect to a window share, it's my opinion that S.S.H.F.S. is far less trouble to set up.
Especially since most distros come with S.S.H. Server already installed.
And that's all you need on the remote system. You don't need S.S.H.F.S. on the remote system.
You just need to have S.S.H. Server running.
And the first thing you need to do when preparing to use S.S.H.F.S. is to create a mount point on your local computer.
For most purposes, I recommend that this should be a folder inside your home folder.
You should plan to always leave this folder empty because S.S.H.F.S. won't mount inside a folder that already has files in it.
So all you should be using this folder for is as the S.S.H.F.S. mount point.
Now maybe if I had a machine that had multiple users instead of setting up S.S.H.F.S. mounts under each user's home directory.
Let's say you have a home server and you have shared video files or something, home videos, photographs, whatever.
That's what you're using your server for.
And you want everybody to have access to that.
And you have one machine with multiple log-ins and multiple users.
So instead of having each user mounting S.S.H.F.S. into their home folder, perhaps you'd want to do a common folder, some place.
And then so that would show up in the home folder, you could use a Simlinks in every user's home folder.
So that would appear that this common folder somewhere on the computer was in every user's home folder.
I think it's probably just as easy to use S.S.H.F.S. for each user because they're not all going to be.
Well I can't possibly, well I wouldn't say can't possibly.
For most people's use cases, only one user is going to be logged into one machine at once.
That's just because the way modern PCs are built.
While Linux and Unix are multiple user operating systems, we tend to use them at home at least one user at a time.
And I'm making this far more complex than I had intended.
So let's go on to the next topic.
S.S.H.F.S. The Command Syntax reminds me a lot of the other extended commands based on S.S.H. like SCP.
So the basic format is Command S.S.H.F.S. Space.
Your user name on the remote computer at IP address of the remote computer.
And of course if you've got the host name for that computer set up somewhere, you could just...
You could set up somewhere to resolve to an IP you could use of course a host name.
Now this is very important. After the IP or the host name, you have to include...
Right after that needs to be a colon.
And you look at my example in the show notes and I'm going to explain that in a minute with that.
And then space and then the mount point on your local computer.
So slash, home, slash, your user name, slash the folder you created to use as a mount point.
Okay, now some people are going to need more than just the basic options I know that I do.
So let's cover those.
Okay, well I'm going to give a real-world example for my system.
My home server is on 192.168.2.153.
I met you again, you could use a host name instead of the IP for the sake of the argument.
Let's say my mount point for network storage is slash home slash 50 slash storage.
So then I would mount the storage from my server in my home directory by issuing SSHFS space 50 at 192.168.2.153 colon.
Space slash home slash 50 slash storage.
Now of course you could always use relative path to the mount point.
If you're in your home folder then of course you could just use storage.
You would have to do the explicit path from the root.
I prefer to do it that way using explicit path but you certainly don't have to.
And then your whole home directory on your remote system will be mounted will appear to be in that folder.
So in other words what appears on my server to be slash home slash 50 every file in there on my laptop shows up in slash home slash 50 slash storage.
Now let's say you don't want to mount your whole remote folder in the case of my server or your remote home folder.
In the case of my server I have a folder called storage under my home folder so I'm using the same folder name on both machines.
But if I mount storage under storage on my home server then I'm sorry on my workstation on the workstation the folder looks like home or I'm sorry looks like slash home slash 50 slash storage slash storage.
So wouldn't it be easier if I could mount if I could just go directly into that storage folder because I usually I have no reason to mess with the configuration files and all that on the server.
If I want it in my home folder on the server if I want to get into that I can SSH into the server and manipulate those on the server rather than trying to manipulate them as as managed files.
But well I'll get to the butt in a minute.
So let's say again and probably clear this up some all your shared storage is in a folder that's underneath your home folder on your server.
And that's all you want to share is your shared storage.
I mean shared in my case not between other people but between other computers.
I've got a lot well I've got laptops that only have 500 gig.
I've got you know raspberry pies some of them don't aren't running with external storage.
And so make it eat well for one thing to make a shared place to transfer files from one to the other.
That's a good use for a shared server and the thing is archive files.
ISOs, podcasts, videos or whatever that I may have downloaded and I want to be able to see these on each of my computers.
So instead of when I say well I'd like to download that YouTube video and look at it later.
Instead of downloading it to my laptops hard drive which again is only 500 gig.
I download it to the five terabyte storage on the server.
And then it's available to any workstation on my network.
So I said I've got all that stuff the archives things I want to share.
Things not to do with the operation of the server of my account on the server.
That's in a subfolder of my home directory on the server.
So the easy way to mount that is I can...
If I don't want to deal with all that stuff with my home folder I just want to deal in the subfolder under my home folder.
That's what I want to share.
I can modify the command to be SSHFS space 50 at 192.168.2.153 colon storage space slash home slash 50 slash storage.
So in other words what whatever you put after the colon it's SSHFS is assuming you're starting in whatever user name that you gave it.
You're starting in their home folder and you say well I don't want to have...
I don't want to mount everything in my home folder.
I just want to mount this sub directory that's in my home folder.
It has all the stuff that I want to share between all my computers.
Well that's how you do it.
You put in the name of that sub directory after the colon.
But in any case the colon's always got to be there.
Whether you've got a sub directory behind it or not.
Of course you could go down several sub-directories if that's what you wanted to do.
And if you could also do it you could do explicit.
You could do the colon and then slash home slash 50 slash storage.
I don't think you could do like colon slash and dump yourself into the root directory.
I don't know I guess I've never tried that.
You might be able to walk around the root directory but unless your user has root access you wouldn't be able to modify anything certainly.
But now we come to rub in my situation.
Since my server is a Raspberry Pi and the five terabyte shared storage for the network,
it's an external five terabyte hard drive.
It auto mounts under media automatically just by being plugged in during boot up.
But I want to have that, you know, I need to have that mounted in my home folder so I could access it with the SSHFS with the home folder on the server.
So I use a simlink to simlink that sub directory that's under slash media into my home folder.
Now apparently you a lot of distributions do not like to using SSHFS go directly into a simlink.
Now I was able to do it with my Debian and I thought I'd been able to do it with other other distros before but I haven't been able to do that in Ubuntu.
I haven't been able to do it with OpenSus if I try to go in straight down the storage folder gives me an error.
If I go into my home folder no problem and then I can work my way down to the storage folder.
Now, okay, this is another thing that's very important you need to remember.
If you have any simlinks and you probably should just start out assuming even if you don't have simlinks on your server now that sometime you might, you need to append the option dash o space follow underscore simlinks to your SSHFS command.
Because if you don't do that it's the simlinks are not you're not going to be able to.
Simlinks are not going to be recognized as folders and you're not going to be able to navigate into them.
Now the dash o follow simlinks comes at the end of the command which is also unusual.
We're usually we're used to arguments in Linux commands directly following the command itself and before the parameters.
In other words the server you're mounting to and the mount point we would usually expect an argument to come first.
In this case it goes the end. There's other arguments which I'm about to get to for SSHFS that do come directly after the command.
One I think is probably most pertinent is dash p for ports. Let's say you're not doing this on your local network.
Let's say you actually want to mount storage from a server located out on the internet. Well you can do that.
Probably as we as we found out with the hookers episode if there if there's a server out there on the internet with an open SSH port.
If the administrator knows anything about what they're doing is not on default port 22 it's on something else.
So that's where your dash p comes in.
So let's say the server theoretical server out on the internet it's got SSH running on port 1022.
Then your command would look more like SSHFS space dash lowercase p space 1022 space.
Username at IP address colon subfolder if there is one space local mount point space dash oh also lowercase oh space follow underscore sim links.
And reading through the man page the only other thing that I think the average user might need it.
There's also a dash oh space allow underscore root which I would expect means would mean that you could log in direct rather than logging into users or I'm sorry rather than mounting a user's home folder.
You would you would mount all the storage on the machine directly from root I assume you'd also have to be logging in as root user to do this.
I don't I really would not recommend any of that but obviously it is an option.
So I do not where this is pro I happen to know that in general if you SSH in into a machine is root you're not going to be at this hard explain you're not going to be at slash the top level you're going to be literally in slash R O O T.
And that's sort of the home directory for the root user doesn't it's not in with the regular home directories and the reason I know that years ago I bought a
a Chumby clone different brand but sort of the same sort of the same setup I think they were related somehow and running all the little apps and I found out really I couldn't find any of the little apps user made or otherwise that were available that was anything
that was interesting to me supposed to be like a digital alarm clock or rather I guess could be digital but a smart alarm clock.
So I just plugged in a external hard drive to it and uses a server but the three or four years I used it.
I never did find I could create regular users but I never would I don't know why it never would allow me to SSH in the box is anything but root.
So that's how I knew you you wind up in slash in slash R O O T if you log in is log in is root and I don't think there's no sub no subfolders under that.
So I don't think you'd be able to really go anywhere if you if you if you mounted slash root yeah if some it yeah that the Chumby got me in the trouble really if any I'm sure you a lot of you folks listen to this probably hang out in the free node channel
August planet and the first the first day I had it I I was on Android application I think and chat in IRC and because I was eating a restaurant and proudly told everybody I'd spent the previous evening playing with my eight inch Chumby but you spell check kind of bit me on that so everybody thought I was being rude.
So that's that that's an interesting story that probably should make this episode explicit okay.
Oh yeah yeah also at this point I could explain to you how to modify your slash Etsy slash F stab to automatically mount an SSH F S partition but I'm not going to do that
do that because pretty much universally storage is bounded before the network is up and running so you know anything modifications you made to that CS stab would be ignored or maybe even cause a crash because there's no there's no network out there for their
remote file to be mounted on now of course if you really wanted to do it that way you you could modify the order in which systems are loaded in Linux so that the network would be up and running by
the time slash Etsy slash F stab was processed I just think it's a whole lot easier if you want to automatically connect to the server or mount or mount the server
just put whatever part of the commands we've been talking about that are appropriate for your situation into a shell script and have that shell script be mounted automatically at some point after log on.
Another thing we want to look out for let's say well sometimes sometimes you'll mount the remote partition or remote storage and for an unknown reason the network connection will break and you don't you don't notice that or maybe you reboot the computer and you forget to run your shell script to mount the remote storage.
Let's say you go into a browser like Firefox and you click on a link to download and it just happens that it's in your satisfied with the download folder on I mean let's say your last download was to point on
the server on that on the FSH FS shared storage and so you're going to store it right in the same place so you just click on save well it's not going to check that the server is mounted
because that's transparent to the browser it doesn't know if that's a remote storage mount point.
So it's going to go in your mount point in your home directory and say maybe that was several subfolders down on the server.
It's going to create all those folders and then that one loan file or maybe if you selected several files to download and then you'll look and see well my server's not mounted but I've got it looks like all those folders are in there.
But assuming your directory structure branches at some point it's going to be awful obvious oh yeah it's just it's only stored this one path and at the bottom of that path there's this file I downloaded.
So that's easy to fix you copy so you don't have to reload download it you copy that file somewhere else on your local hard drive.
Then you go to your mount point in your home folder and you just delete all those junk folders that were created then you reestablish your mount to the server and when you get all that done go back wherever you sit wherever you copy that file to and then move it over to the server.
It's fairly simple but it's it's something to watch out for.
Okay oh um yeah skipped over one thing I see the other day you know I told you about the option the dash oh follow semblance so that's something I have to put on every every time.
I'd set up this other computer to actually process or help me process some audio files from the New Year's Eve show so I could run audacity on more and one computer.
And all those all those files were saved the storage on the server and like a big dummy I forgot the dash oh follow semblance so yeah I'm out of the server but the subfolder that I needed to access wasn't there.
Because I didn't put in follow semblance so rather I mean rather rebooting the the local computer which would have taken care of it because the command you need to unmount the SSHFS remote volume is fuser mount space dash a lower case you space and then the mount point.
You know path path to wherever that mount point is and then you'll you look at that mount point it'll be a pristine empty directory again and then you can go back and and remount your network storage and this time remember to put in dash oh space follow underscore semblance and you'll be back in business.
Okay we do have I have been asked in this last week when I'm going to do another 51 50 shades of beer and my answer is it's probably going to be a little while because I still have all those conference interviews and topics from last year I still have tech stuff I want to do I just don't want to take away from getting some of those more serious shows out.
Just to talk about beer but as I have been want to do recently I am reviewing one beer tonight along with the technical topic.
Our beer for tonight and I apologize to this for because I'm going to butcher the name.
We in Stefan Hanner or we in Steph Hanner or we in Steph Hanner I guess that's that's pretty close and there and particular beers their Vitus and is described on the bottle as a wise and buck so what does that what does that mean well you should remember from previous episodes wise and wheat.
Buck is a strong logger so this is a strong wheat logger and it's 7.7 alcohol by volume so yeah that's not that's not bad on that scale and the main thing that about this beer that I notice is the carbonation very very effervescent.
Probably not going to be able to pour the whole bottle into a glass until you wait for the head to subside a little bit pours with a lot ahead for a high ABV beer so I imagine some they're doing something in their process to intentionally increase the carbonation I think they describe as a fairly yeasty beer so that that would explain a lot of it.
It's pours sort of a cloudy amber but there's no you know dead loose yeast floating around like you will see with some craft beers so all the yeast is consumed or at least they filtered out before they put it in the bottle.
Aroma definitely some aroma of banana I would yeah I cheated I looked at the website to see their description.
Yeah and I could probably be pushed to say that I smell some apricot in there maybe but yeah as far as flavor definitely you know you're drinking a wheat beer and it's a little on the fruity sweet side not not certainly not clawingly.
But it's only 17 international bitterness units so not not a very hoppy beer by any means it's a quite pleasant beer it's said I I'm not that appreciative beers that I have to hunt around and try to figure out what that you know the taste it's not it's not a very bold leaf flavored beer.
And the main the main attribute seems to be the carbonation so I'm not you know certainly an enjoyable beer but probably one that I'm not going to seek out again in the future okay.
Well I've been 51 50 year host this evening for hacker public radio we're getting kind of short on shows I think that may change once we get the hit with the New Year's Eve stuff but still we're kind of in a slump right now we'd appreciate you folks sending in some shows and with that I'll sign off for this evening thanks for listening.
You've been listening to Hacker Public Radio at HackerPublicRadio.org we are a community podcast network that releases shows every weekday Monday through Friday.
Today's show like all our shows was contributed by an HBR listener like yourself if you ever thought of recording a podcast then click on our contributing to find out how easy it really is.
Hacker Public Radio was founded by the Digital Dove Pound and the Infonomicon Computer Club and is part of the binary revolution at binrev.com.
If you have comments on today's show please email the host directly leave a comment on the website or record a follow-up episode yourself.
Unless otherwise status today's show is released on the creative comments, attribution, share a light 3.0 license.