ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

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.

ความคิดเห็น • 105

  • @DirtPoorWargamer
    @DirtPoorWargamer 2 ปีที่แล้ว +39

    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.

    • @voiceoftreason1760
      @voiceoftreason1760 2 ปีที่แล้ว

      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?

    • @DirtPoorWargamer
      @DirtPoorWargamer 2 ปีที่แล้ว +2

      @@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.

    • @SebastianSipos
      @SebastianSipos 2 ปีที่แล้ว +1

      @@DirtPoorWargamer you were clear

  • @McDuffington
    @McDuffington 2 ปีที่แล้ว +23

    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.

    • @s0litaire2k
      @s0litaire2k 2 ปีที่แล้ว

      Same here! on my Plex / File server. it's handy moving things around without messing with rsync / ftp.

    • @kristun216
      @kristun216 2 ปีที่แล้ว +1

      nice to know you can do that, i've been painfully using vi on the server machine which is quite painful

    • @McDuffington
      @McDuffington 2 ปีที่แล้ว +1

      @@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)

  • @DMSBrian24
    @DMSBrian24 2 ปีที่แล้ว +11

    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

  • @paimonbutter
    @paimonbutter 2 ปีที่แล้ว +4

    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

  • @shaytal100
    @shaytal100 2 ปีที่แล้ว +2

    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.

  • @RichardJActon
    @RichardJActon 2 ปีที่แล้ว +1

    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

  • @syrefaen
    @syrefaen 2 ปีที่แล้ว +2

    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.

  • @scheimong
    @scheimong 2 ปีที่แล้ว +2

    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 👌

  • @brunoais
    @brunoais 2 ปีที่แล้ว +2

    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.

  • @Nukelover
    @Nukelover 2 ปีที่แล้ว

    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.

  • @SebastianSipos
    @SebastianSipos 2 ปีที่แล้ว

    cool discovery.
    For static website changes, I recommend tracking using git and "push to deploy". A post receive hook would do this easily.

  • @scheimong
    @scheimong 2 ปีที่แล้ว

    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.

  • @tassaron
    @tassaron 2 ปีที่แล้ว +1

    ohohoho, I remember how excited I was when I first discovered sshfs 🙂

  • @xard64
    @xard64 2 ปีที่แล้ว

    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".

  • @CobaltSpace
    @CobaltSpace 2 ปีที่แล้ว +2

    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.

    • @killistan
      @killistan 2 ปีที่แล้ว

      I'd just do that in /etc/hosts. Then you can also ping or sshnuke that computer by name, for instance.

    • @kebien6020
      @kebien6020 8 หลายเดือนก่อน

      It also allows you to set a remote user, a custom port, a custom identity file, etc. Really convenient tbh

  • @johannvaniperen7249
    @johannvaniperen7249 2 ปีที่แล้ว +1

    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

  • @eliseuvideira1319
    @eliseuvideira1319 2 ปีที่แล้ว +2

    Definitely interesting, but I'm still sticking to rsync since I just need to sync things once in a while.

    • @billeterk
      @billeterk 2 ปีที่แล้ว

      Unison can be useful for syncing too as it’s bidirectional

  • @topherfungus8424
    @topherfungus8424 2 ปีที่แล้ว +2

    Might want to check that you exclude your ~/remote directory in your backups.

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว

      You'd probably want to put it somewhere different but it's just there for testing

  • @katnax3059
    @katnax3059 หลายเดือนก่อน

    2 years later and it's still the same version of SSHFS, truly shame that it's not being maintained.

  • @wintc
    @wintc 2 ปีที่แล้ว

    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!

  • @edwardecl
    @edwardecl 2 ปีที่แล้ว +1

    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.

    • @dreamcat4
      @dreamcat4 2 ปีที่แล้ว

      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

  • @GottZ
    @GottZ 2 ปีที่แล้ว +1

    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.

  • @jeffsadowski
    @jeffsadowski 2 ปีที่แล้ว

    I had used sshfs in the past. It sometimes had some weird permission issues when I was using it last.

    • @jeffsadowski
      @jeffsadowski 2 ปีที่แล้ว

      It might have been using the same mount with different users.

  • @Lutitious
    @Lutitious 2 ปีที่แล้ว +1

    yeah i use sshfs and its great

  • @itachi2011100
    @itachi2011100 2 ปีที่แล้ว

    welcome to the gang

  • @nobodyofconsequence6522
    @nobodyofconsequence6522 2 ปีที่แล้ว

    nemo and dolphin both have inbuilt sftp browsers. and there's also the scp command.

  • @perfishfan
    @perfishfan 2 ปีที่แล้ว +2

    I prefer rclone mount because without caching many gui tools have trouble

  • @samzick6301
    @samzick6301 2 ปีที่แล้ว

    sshfs is incredibly useful when used with autofs

  • @CMDRSweeper
    @CMDRSweeper 2 ปีที่แล้ว

    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.

  • @CjqNslXUcM
    @CjqNslXUcM 2 ปีที่แล้ว

    KDE Connect uses sshfs on your phone to connect via the dolphin side bar (assuming the phone is in the same wifi)

  • @jort93z
    @jort93z 2 ปีที่แล้ว

    very cool application, never heard of it. I will try it out.

  • @dreamcat4
    @dreamcat4 2 ปีที่แล้ว

    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

  • @uuu12343
    @uuu12343 2 ปีที่แล้ว +1

    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

  • @Fr00bOase
    @Fr00bOase 2 ปีที่แล้ว

    I think you missed one of the most important things to use sshfs comfortably: setting up auto mounting on demand with systemd via fstab.

  • @davidgomez79
    @davidgomez79 2 ปีที่แล้ว

    I use it to vim remotely. I been telling this to EMACS users forever

  • @thiagovfar
    @thiagovfar 2 ปีที่แล้ว +2

    The slowness on changing directories might be due to your shell/prompt listing files prior to returning control to you.

  • @Ju13n1s2e9
    @Ju13n1s2e9 2 ปีที่แล้ว

    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?

  • @JG-nm9zk
    @JG-nm9zk 2 ปีที่แล้ว

    every body in my cs program knew about this.

  • @killistan
    @killistan 2 ปีที่แล้ว

    I want sshfs and ddrescue on a livecd. I've needed that combination quite a few times...

    • @killistan
      @killistan 2 ปีที่แล้ว

      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.

  • @pillmuncher67
    @pillmuncher67 2 ปีที่แล้ว

    I did not know that.

  • @virkony
    @virkony ปีที่แล้ว

    Any chance sshuttle may be an another discovery? 😉

  • @QmVuamFtaW4
    @QmVuamFtaW4 2 ปีที่แล้ว

    damn, looks really useful. now i need a web server first.

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว

      Install an ssh server on your phone

    • @QmVuamFtaW4
      @QmVuamFtaW4 2 ปีที่แล้ว

      @@BrodieRobertson thats a nice idea, thanks brodie

  • @nubilate
    @nubilate 2 ปีที่แล้ว

    that’s nice and all but where did you get that hoodie?

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว

      It was one of the early pieces of vshojo merch, but it was limited time only

  • @leteethgirl8778
    @leteethgirl8778 2 ปีที่แล้ว

    been using this for fileserving that treats the local network as hostile since 2017

    • @leteethgirl8778
      @leteethgirl8778 2 ปีที่แล้ว

      i had a libreelec board that mounted a seedbox and it was capable of quite seamless playback

  • @eduardmart1237
    @eduardmart1237 2 ปีที่แล้ว

    Is there a good sftp GUI client for Linux?
    Something akin to bitvise for windows

  • @iankester-haney3315
    @iankester-haney3315 2 ปีที่แล้ว

    Interesting. I just figured out how to fstab a cifs volume at boot up. Then my Plex Server just saves to the mounted folder.

  • @ribosomerocker
    @ribosomerocker 2 ปีที่แล้ว

    good question.

  • @MartinsTalbergs
    @MartinsTalbergs 2 ปีที่แล้ว

    Never used that. Would this work if the remote srv directory is another sshfs mountpoint? (Jumpserver)

  • @bestledisthe
    @bestledisthe 2 ปีที่แล้ว

    I think KDE Coonect uses sshfs?

  • @AK-vx4dy
    @AK-vx4dy 2 ปีที่แล้ว

    Nice font in term - can we know name ?

  • @agentlytle
    @agentlytle ปีที่แล้ว

    What software uses that lf command

  • @entelin
    @entelin 2 ปีที่แล้ว

    I use sshfs, though it does seem a bit flaky from time to time. Prefer NFS if it's not an occasional thing.

  • @LloydLynx
    @LloydLynx 2 ปีที่แล้ว

    I'd bet money that someone out there mounts their /home this way.

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว

      If someone will use google drive as swap then surely

  • @insu_na
    @insu_na 2 ปีที่แล้ว

    I wonder if sshfs+rsync could be a thing

    • @killistan
      @killistan 2 ปีที่แล้ว

      Easily. rsync supports using ssh already, though; so you might prefer to do it that way, instead.

    • @insu_na
      @insu_na 2 ปีที่แล้ว

      @@killistan I can't mount a virtual filesystem with rsync tho, pretty sure

    • @killistan
      @killistan 2 ปีที่แล้ว

      @@insu_na no, but you can copy whatever files you want just fine.

    • @insu_na
      @insu_na 2 ปีที่แล้ว

      @@killistan yeah, but that isn't what makes sshfs so cool :D thanks for your input tho! :)

  • @rajufelix3070
    @rajufelix3070 2 ปีที่แล้ว

    Used it to give servers to ROM devs.
    There's a problem here.
    Try compiling using sshfs. It'll fail.

  • @bennihtm
    @bennihtm 2 ปีที่แล้ว

    You might wanna block the access to git directories on your website

  • @lua-nya
    @lua-nya 2 ปีที่แล้ว

    I tend to use emacs tramps these days.

  • @vilijanac
    @vilijanac 2 ปีที่แล้ว

    My backup.sh, backup_list.sh and backup_restore.sh scripts use it.

  • @anon_y_mousse
    @anon_y_mousse 2 ปีที่แล้ว +1

    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.

    • @DMSBrian24
      @DMSBrian24 2 ปีที่แล้ว +1

      Who cares lmao, what can you do with some dynamic ip constantly reassigned by an isp xd

    • @anon_y_mousse
      @anon_y_mousse 2 ปีที่แล้ว

      @@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.

    • @killistan
      @killistan 2 ปีที่แล้ว +1

      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...

    • @killistan
      @killistan 2 ปีที่แล้ว +1

      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 ;)

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว +3

      I showed the IP to the server hosting my public website? The IP you connect to every time you visit my site lol

  • @caesarxinsanium
    @caesarxinsanium 2 ปีที่แล้ว

    your mic covering up the word on your sweater makes it look like a really bad word.

    • @BrodieRobertson
      @BrodieRobertson  2 ปีที่แล้ว

      I have no idea what word you're even thinking of

  • @JG-nm9zk
    @JG-nm9zk 2 ปีที่แล้ว

    fn noob

  • @Coopertronics
    @Coopertronics 2 ปีที่แล้ว

    Are you Fluffing kidding me? SSHFS is the only way to use a home/business network

    • @Coopertronics
      @Coopertronics 2 ปีที่แล้ว

      just wait until you get into the app portals tunnelling stuff ...

  • @QuimChaos
    @QuimChaos 2 ปีที่แล้ว

    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!

    • @UKprl
      @UKprl 2 ปีที่แล้ว +1

      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).

    • @UKprl
      @UKprl 2 ปีที่แล้ว

      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.

    • @killistan
      @killistan 2 ปีที่แล้ว

      @@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.