ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
SSHFS: Easiest Way Mount Drives Through SSH
ฝัง
- เผยแพร่เมื่อ 10 มิ.ย. 2022
- I can't believe I'm just discovering SSHFS this is such a great way to access a remote drive on my web server and all it needs is SSH, which I was already using anyway
==========Support The Channel==========
► $100 Linode Credit: brodierobertso...
► Patreon: brodierobertso...
► Paypal: brodierobertso...
► Liberapay: brodierobertso...
► Amazon USA: brodierobertso...
==========Resources==========
SSHFS Github: github.com/lib...
=========Video Platforms==========
🎥 Odysee: brodierobertso...
🎥 Podcast: techovertea.xy...
🎮 Gaming: brodierobertso...
==========Social Media==========
🎤 Discord: brodierobertso...
🎤 Matrix Space: brodierobertso...
🐦 Twitter: brodierobertso...
🌐 Mastodon: brodierobertso...
🖥️ GitHub: brodierobertso...
==========Credits==========
🎨 Channel Art:
All my art has was created by Supercozman
/ supercozman
/ supercozman_draws
#SSH #SSHFS #Linux #linuxtutorial
🎵 Ending music
Music from filmmusic.io
"Basic Implosion" by Kevin MacLeod (incompetech.com)
License: CC BY (creativecommons...)
DISCLOSURE: Wherever possible I use referral links, which means if you click one of the links in this video or description and make a purchase I may receive a small commission or other compensation.
One thing to know about sshfs: when moving files on one sshfs share to another sshfs share that exists on the same machine, the data flows through your remote machine. This means that you will be downloading and reuploading every bit you move in this way.
That's what I'd assume that would happen. Are you implying that instead you should ssh over to pc1 and rsync to pc2 in such a case?
@@voiceoftreason1760 I might not have been entirely clear: I meant when you mount two different folders from the same server and transfer files between those folders. I actually assumed that since I was moving files from one folder to another on the same computer, it wouldn't transfer the data over the network first. The behavior surprised me when I went to do a multiple TB transfer while reorganizing my drives.
@@DirtPoorWargamer you were clear
I use sshfs daily. To access my media library from Kodi (instead of smb) , and to mount remote file systems so I can use my local tools (like nvim).
It's super fast and also works over reverse ssh, allowing me to access systems without any incoming network ports open.
Same here! on my Plex / File server. it's handy moving things around without messing with rsync / ftp.
nice to know you can do that, i've been painfully using vi on the server machine which is quite painful
@@kristun216 vim also can open remote files itself,
$ vim scp:/user@server/~/.bashrc
But in my case I more often do
$ sshfs user@server:/~ /mnt/server
(you are not root, so still require priviledges)
This is what I've always used for any file transfer, gnome offers great integration with it through nautilus too, haven't had to use samba since I discovered it
dude your window manager setup is BEAUTIFUL! only time I've ever been actually impressed by one, please make a tutorial video or something on it cause I want that. edit: specifically your terminal file browser
Yes I am using it all the time. You can also add an sshfs entry to your fstab file. That way the remote file system will automatically mounted like any lokal disk.
Most file manager can use sshfs as well. With thunar just type sftp:// followed by server hostname or IP address. Create a shortcut from that and even non computerphile people (like my sister) can easily use a remote server to exchange files.
Used this all the time for doing stuff on HPC clusters during my PhD, had a couple of mounts set up permanently in fstab it was super useful - I hope it gets a new maintainer
I used to use sftp every day, but this makes it easyer. Fantastic, don't know how i missed it. If you have mpv you need ffmpeg compled with ssh support to stream media.
I used sshfs to mount the storage of my main server onto my server in Moldova. This way I can torrent all the Linux ISOs I want without the VPS ISP going after me 👌
I've been using sshfs for a long time now. However, more often than not, I use it through (and managed by) the file manager than using it on the command line myself.
sshfs is what I used for years to play the videos on my home video server when on the road. I use Plex for that now, but I still use sshfs for securely editing project files on the road.
cool discovery.
For static website changes, I recommend tracking using git and "push to deploy". A post receive hook would do this easily.
Also KDE's dolphin file manager internally uses sshfs when accessing network locations via sftp (same thing with Gnome IIRC). So lots of users might already be using sshfs without knowing it.
ohohoho, I remember how excited I was when I first discovered sshfs 🙂
I've been using SSHFS for transferring files between Linux clients, Linux servers, Macs and Android devices and it just works. It's like the modern day FTP with encryption. Setting up anything else feels like busywork with very little benefit. Of course the SSHFS has some pitfalls like you described but that does not make it any less convenient. Also setting up login with keys works alongside with SSH as a bonus.
Though I've encountered vocal opposition about the SSHFS that it's "technically rediculous and childish", "it shouldn't be used anywhere" and "smb is the only viable solution" but I've never seen explanation "why".
In your ssh config, you can make it so when you ssh to a certain string, it will then actually ssh to an IP you set.
I'd just do that in /etc/hosts. Then you can also ping or sshnuke that computer by name, for instance.
It also allows you to set a remote user, a custom port, a custom identity file, etc. Really convenient tbh
From my experience, pretty much every GUI file manager also has sshfs support. I’ve been using nautilus for this (that’s how I found out about it). Now, instead of a samba share, I can just use sshfs with no extra configuration
Definitely interesting, but I'm still sticking to rsync since I just need to sync things once in a while.
Unison can be useful for syncing too as it’s bidirectional
Might want to check that you exclude your ~/remote directory in your backups.
You'd probably want to put it somewhere different but it's just there for testing
2 years later and it's still the same version of SSHFS, truly shame that it's not being maintained.
nice! im pretty new to linux so this is good to know. ive been using tons of repetitive ssh/scp commands to edit my website from home PC..now my workflow is gonna be way nicer!
I did know of it before, but I also heard that is not the greatest if you want to copy stuff fast, probably fine for remote server stuff but I was looking at it more from a local network kinda thing.
I just tend to use autofs combined with NFS for local stuff (autofs fixes a lot of the mount/unmount hangs)...
What I really want that does not yet exist, is a network file system that supports compression, bonus points if it interacts with BTRFS + ZSTD and copies without re-compressing. I know rsync can do compression, but would be nice to have something that just acts like a mount point.
i beieve btrfs was trying to re implement the functionality of the zfs send/recv. however not sure where that is at right now since i never follow btrfs development as dont use it myself
sshfs is nice until your connection becomes unstable and causes infinite iowait on your cpu.
(just a random thing to keep in mind)
Oh before I forget this mindblowing hint:
~/.ssh/config will allow you to set ports and proxyjumphost configuration etc. so using -p in sshfs becomes boilerplate.
I had used sshfs in the past. It sometimes had some weird permission issues when I was using it last.
It might have been using the same mount with different users.
yeah i use sshfs and its great
welcome to the gang
nemo and dolphin both have inbuilt sftp browsers. and there's also the scp command.
I prefer rclone mount because without caching many gui tools have trouble
sshfs is incredibly useful when used with autofs
Yes, SSHFS is a useful tool to have.
But it is fairly slow at times, so it is limited in what you can use it for, but sftp protocol is one of the greatest inventions though!
Slip that in on a Windows box and you have less hassle getting your files remotely than dealing with the remote desktop crap.
Slow is still better than nothing
KDE Connect uses sshfs on your phone to connect via the dolphin side bar (assuming the phone is in the same wifi)
very cool application, never heard of it. I will try it out.
the main reason i dont use this (or in fact any other fuse based remote filesystem) ...is that it feels so dodgy. all the lagginess, and perhaps errors occuring or unresponsiveness. it all makes for a lack of trust into something that is typically handling important files. so given the fact that you cant really treat it just like a native local folder (or even liken it to an nfs or a samba share, because this fuse stuff is even worse). then the tools i prefer to use instead are things like rsync or git (or zfs send/recv) which also can be used over an ssh connection. the main difference being is that something like rsync can be run in as a sync task. it can then do checksumming / verification. and provide a log file. and the incremental nature means that an interrupted upload (for example due to lost network link)... that isnt going to result in a silently corrupted file. but instead you get to know the transfer failed. and then simply running exactly the same rsync command again once your remote connection is back to normal... that will be able to complete and finish successfully any partial or previously failed upload.
of course that does involve more hassle setting up tasks (and maybe with inotify to trigger syncs automatically). but that is also why we have rsync gui wrappers such as luckybackup that makes it easier to use rync. not only does luckybackup abstract a lot of that rsync flags pain away. it also includes a reverse option that then spits out back to you the equivalent direct rsync command. which is then immensely useful. because you can then put it into a cron job or other automated script
but having said that i do also understand the whole point of this video. which is try try to find much simpler ways access a remote folder. with far less hassles and the lowest possible friction. so if you do still need to resort to something like this which uses fuse underneath as the glue for mounting ....then maybe rclonetray is actually an even better option to consider. because rclonetray (via rclone) actually supports a heck of a lot more remote connection methods than just only ssh. and it then makes them all equally easy and simple to mount and appear as local folders. including many very popular and ubiqutous other protocols such as amazon s3 buckets and many more (basically everything under the sun, the full list is very comprehensive including google drive, and onecloud, webdav. you name it, then rclone almost definately supports it).
so well... just use whatever you like. and will of course eventually find out for yourself if that specific choice was indeed satisfactory or not. and if not then can always try something else instead ....i just hope that my commentary wasnt completely wasted here and that it ended up helping somebody. have a good day now
Hol up
There's a wrapper for sftp that lets me use it as a "Local" file directory?!
WHY HAVE I NOT HEARD OF THIS BEFORE
I think you missed one of the most important things to use sshfs comfortably: setting up auto mounting on demand with systemd via fstab.
I use it to vim remotely. I been telling this to EMACS users forever
The slowness on changing directories might be due to your shell/prompt listing files prior to returning control to you.
Didn't know about this - thanks for let me learning something very useful. Very sad if it goes abandoned, hope that desn't happens. Btw have a question - is nfs mount still the better options or sshfs actually may be good enough to do file sharing as a replacement of nfs ?
Also - the comment about unmounting was somewhat fuzzy, like from what you say the command name is just something on random, but if that is - what is the actual full command for unmounting? Or did I miss something?
every body in my cs program knew about this.
I want sshfs and ddrescue on a livecd. I've needed that combination quite a few times...
I've found that sshfs (or ssh filesystem in userspace via gio/gvfs) is way faster than samba, even with the encryption. If you're feeling like compiling ssh yourself, you can add the "hpn" (high performance network) patches for ssh, which let you use sshfs /without/ encryption (if you want, along with optimizations to make local area networking faster).
Of course, this only matters on your own lan; not for connecting to webservers.
I did not know that.
Any chance sshuttle may be an another discovery? 😉
damn, looks really useful. now i need a web server first.
Install an ssh server on your phone
@@BrodieRobertson thats a nice idea, thanks brodie
that’s nice and all but where did you get that hoodie?
It was one of the early pieces of vshojo merch, but it was limited time only
been using this for fileserving that treats the local network as hostile since 2017
i had a libreelec board that mounted a seedbox and it was capable of quite seamless playback
Is there a good sftp GUI client for Linux?
Something akin to bitvise for windows
Interesting. I just figured out how to fstab a cifs volume at boot up. Then my Plex Server just saves to the mounted folder.
good question.
good answer
Never used that. Would this work if the remote srv directory is another sshfs mountpoint? (Jumpserver)
I think KDE Coonect uses sshfs?
Nice font in term - can we know name ?
What software uses that lf command
I use sshfs, though it does seem a bit flaky from time to time. Prefer NFS if it's not an occasional thing.
I'd bet money that someone out there mounts their /home this way.
If someone will use google drive as swap then surely
I wonder if sshfs+rsync could be a thing
Easily. rsync supports using ssh already, though; so you might prefer to do it that way, instead.
@@killistan I can't mount a virtual filesystem with rsync tho, pretty sure
@@insu_na no, but you can copy whatever files you want just fine.
@@killistan yeah, but that isn't what makes sshfs so cool :D thanks for your input tho! :)
Used it to give servers to ROM devs.
There's a problem here.
Try compiling using sshfs. It'll fail.
You might wanna block the access to git directories on your website
I tend to use emacs tramps these days.
My backup.sh, backup_list.sh and backup_restore.sh scripts use it.
I can't believe you showed your IP, yikes. Hope you can change it. I've been using sshfs to connect to and from my RPi, it is the best. I tried a samba share but I could only get that working in one direction. I tried NFS first of course, but it wouldn't run on the Pi3, and when I finally got a Pi4 I was like, screw it, sshfs works great. One note, you can actually use umount and it is easier to type.
Who cares lmao, what can you do with some dynamic ip constantly reassigned by an isp xd
@@DMSBrian24 Does your ISP give you a new IP every day? Have you ever gotten the same one multiple times in a row even with a modem reboot? His IP may not be so dynamic, especially if he has a service that maintains a small list.
So your private ip address isn't usually that interesting -- you generally won't/shouldn't have any servers running on your personal ip address. And your public webserver's ip address is well, public. Back when people were unknowingly putting their smb shares directly on the internet, it mattered.
You can also put an sshfs mount in your /etc/fstab, so you can use `mount' as well as `umount'. I don't remember if you can do that without using a passwordless ssh key, though. If you're not careful you can hang your shutdown, if the remote server you're connected too isn't accessible. Might want to use "umount --lazy" in case that happens.
NFS is more of a hassle than sshfs, for sure. I don't even think its actually any faster...
yea, that's a Linode server. Ok to share your webserver's ip address. You kind of need to do that (via dns) if you want other people to find it ;)
I showed the IP to the server hosting my public website? The IP you connect to every time you visit my site lol
your mic covering up the word on your sweater makes it look like a really bad word.
I have no idea what word you're even thinking of
fn noob
Are you Fluffing kidding me? SSHFS is the only way to use a home/business network
just wait until you get into the app portals tunnelling stuff ...
i've been using sftp in nautilus/gnome files for ages and it's great for me, i can browse any folder and at full network speed... i just type int the address bar sftp://[server_name or ip]/ autenticate and go!
yes I remember the day on a whim I typed ssh://servername into the file manager location bar and it prompted to login, a "What..?" moment.
sftp:// is more standard though and better for bookmarking.
I also found that as long as your local user's SSH public key is added to the remote authorized keys it can use that and connect without password (including if password-based login is disabled on the server).
Just to add, I believe the file manager method typically uses GVFS behind the scenes and don't know if that relies on the fuser mount systems or not, as it tends to abstract some of the complexity for you.
@@UKprl gvfs has been replaced by gio, which works the same way basically. Both systems also handle your "trash" and mounting things like audio cd's (which certainly don't have filesystems).
The main downside is the mount points are pretty well hidden from you, as they're expecting you to use a gui. Otherwise you're supposed to use `gio copy' instead of `cp', etc (although the normal tools will work). Also, when I was testing it, sshfs was a tiny bit faster on my lan. Both ways were much, much faster than samba.