How to Mount Remote Linux Filesystem or Directory Using SSHFS Over SSH

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Hosting referral link if you planning to start your blog ($3.82/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

32 Responses

  1. Joseph says:

    I followed the steps and created the mount. I am able to see the server files in my local Linux env. But I am not able to read or copy the file.

    It is throwing error as

    more EDI832.dat
    EDI832.dat: No such file or directory
    

    the file and folder user name is changed to users with permission 700
    What am I doing wrong?

  2. Adil says:

    The adding of line in fstab is ‘either I’m doing it wrong’ or there’s some issue with the command itself.

    I added the line below in my fstab:

    sshfs#user@server:/path/to/remote/dir /path/to/local/dir fuse.sshfs defaults 0 0
    

    But the mount -a gives me the following error:

    mount: wrong fs type, bad option, bad superblock on sshfs#user@server:/path/to/remote/dir,
    missing codepage or helper program, or other error
    

    However, when I mount normally without fstab, it works fine.

    Any suggestions?

  3. Federico Ciliberti says:

    Works like charm. But unmounting from Caja gives me an error. I have to do “fusermount -u /path/to/mounted/dir” to unmount the share. Any Ideas?

    • Ravi Saive says:

      @Fedrico,

      Thanks for sharing the tip, but I don’t have idea why you have to mention full path to mounted directory unmount it, the simple command unmount will work in most cases..

  4. Lizbeth says:

    Hello everyone:
    When I mount the files I need, I get two passwords from the remote server and the local one, as specified in the fstab?
    Example: sudo sshfs -o allow_other xxx@xxx.xxx.xxx.xx:/pdf /home/xxx/pdf

    • Ravi Saive says:

      @Lizbeth,

      Its because you running the mount command as sudo user, to avoid asking password twice, try to run with root login..

  5. Andy F. says:

    Aside from the added security, what is the advantage to using this versus something like Samba?

    • Ravi Saive says:

      @Andy,

      Nothing any advantages over Samba or NFS, but in Samba and NFS you need to setup and create a Share directory or filesystem on the server, and in client side you need to install client packages, but in Sshfs, you don’t need to install any packages on Server, just install the sshfs client package on local machine and mount any remote Linux directory over secure layer using SSH…

  6. Parijatha Kumar says:

    I’ve disabled password logins on my SSH server. I connect to my ssh server with my private RSA key. How do I do that in fstab method ?

  7. dwasifar says:

    What’s the benefit of using this method instead of nfs?

    • Ravi Saive says:

      @Dwasifar,

      In NFS method, you need to setup both NFS Server and NFS client to share Linux filesystem, whereas in Sshfs, you don’t need to setup any server, just install the sshfs client on the local machine and mount any remote Linux server filesystem or directory over SSH.

      • Rafael Rojas says:

        It’s SSHFS more secure than NFS?

        • Ravi Saive says:

          @Rafael,

          Yes, ofcourse, as it uses SSH secure layer protocol to connect and mount any remote Linux directory or filesystem over secure network layer, so I can say its safe, fast and more secure..

  8. Richard McNamara says:

    How do I know the proper IP address to use?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 257,757
  2. 11,967
  3. 39,682

Are you subscribed?