jump to navigation

How to mount a remote ssh filesystem using sshfs October 28, 2005

Posted by Carthik in ubuntu.
trackback

SSH is protocol to transfer files securely. Like FTP, but more secure. Many hosting services offer their client the ability to remotely login to their hosting account using ssh. Transferring files to an from an ssh account can be done using the scp command. However, it would be neat if you could mount a remote folder that you can access using ssh on your local computer, so that you can access files on an ssh account just like they were local files on your pc, right? Well now you can! Mount a folder in an ssh account, edit the files locally and save the files, and the file on the ssh server changes too! Isn’t it awesome!!!

We will use sshfs to acheive our goal. The following guide will step you through the process of mouting file systems over ssh on Ubuntu 5.10 Breezy systems.

sshfs:
       sshfs  is  a filesystem client based on the SSH File Transfer Protocol.
       Since most SSH servers already support this protocol it is very easy to
       set  up:  i.e. on the server side there’s nothing to do.  On the client
       side mounting the filesystem is as easy as logging into the server with
       ssh.

Install sshfs by doing a:
$sudo apt-get install sshfs

This will also install fuse-utils and libfuse2, which are required.

Now, let us create a local directory where you want the files mounted. You should create the directory and make yourseld the owner of the directory:

$sudo mkdir /media/dir-name
$sudo chown your-username /media/dir-name

Where “dir-name” is the name of the directory on your local computer where you want to access the files from the remote computer. Say I want the files on the server to be available at /media/home-pc. I want this because the “server” in this case is the desktop I have at home, which allows me to access it through ssh. Let us use “home-pc” as an example for this guide. “your-username” is your username on the local computer.

Go to System->Administration->Users and Groups, select the group “fuse” and then add yourself to this group.

If you prefer to do it the easy way, on the commandline, then use
$sudo adduser your-username fuse

I don’t want to provide a terminal command for adding yourself to a group since there doesn’t seem to be an easy way to add yourself or any user to a group. The only command I know of is the usermod -G command and for this command, you need to list all the groups the user should belong too, even the ones that he/she is already a member of! Anyone know any better on how to add a user to a new group, without having to know what groups he/she is already a member of?
Thanks Shot.

For security reasons, the /usr/bin/fusermount binary is installed in such a way that users cannot execute it. You will have to log out and log in again, to add yourself to the group “fuse”.

Once you have done the above, you can use sshfs to mount the directory you need on the remote host to your local system!

For example, say I want to mount the “/stuff” directory on my home-run server, which has the domain name “example.com”. I would do it by executing the following command:
$sshfs example.com:/stuff /media/home-pc

Where “/stuff” is the folder on the computer with the domain name “example.com”, which I want to mount and access on my local computer at the location /media/home-pc. Remember that the /media/home-pc directory must exist and be owned by you, the user. I already mentioned how to do this in the initial part of this guide.

If you get the following error:

fusermount: fuse device not found, try ‘modprobe fuse’ first

You will have to load the fuse module by doing:
$sudo modprobe fuse

You can add fuse to the modules that are loaded on startup by editing the file /etc/modules and adding a line with only the word “fuse” in it, at the end.

and then issue the sshfs command above again.

To unmount the directory once your work is done, use the command:
$fusermount -u

for example, in my case, I would use
$fusermount -u /media/home-pc

Hat tip: Jorge
More Info: SSH filesystem

Comments»

1. Mammal » sshfs - October 28, 2005

[...] Niedawno zacząłem korzystać z dobrodziejstw sshf, a dziś wpadłem na opis krok po kroku tego wynalazku. Wygodne, szczególnie że nie ma jakiegoś fajnego graficznego klienta, żeby wygodnie korzystać z FTP po SSH - nie, gFTP nie jest wygodny. [...]

2. Shot - October 28, 2005

“I don’t want to provide a terminal command for adding yourself to a group since there doesn’t seem to be an easy way to add yourself or any user to a group.?

adduser user group :)

3. ubuntonista - October 28, 2005

Ah! adduser — the debian way!! Sorry I overlooked that one. To be honest it did not cross my mind at all!

Thank you, thank you!

4. Donncha - October 29, 2005

Very, very nice idea! I’ll be trying this during the week!

5. Holy Shmoly! :: How to mount a remote ssh filesystem using sshfs - October 30, 2005

[...] I had never heard of sshfs, but here’s a quick tutorial on getting it working. Looks very useful! Related Stories (how, mount, remote, ssh, filesystem, using, sshfs) [...]

6. yanis - October 30, 2005

Unfortunately I cant find sshfs using apt-get in my Ubuntu 5.04. I have added all the sources I had found in ubuntuguide.org..

7. Mount via SSH at sil’s babbling - October 30, 2005

[...] Ubuntu Blog has one of the most useful tips yet: How to mount a remote filesystem using SSH. [...]

8. ubuntonista - October 30, 2005

Yanis,

Try http://packages.ubuntu.com/sshfs to see if the package exists in the Ubuntu repos.

I find that it is available only for Breezy. You may not have upgraded to Breezy, which is why you can’t see it yet.

9. Donncha - October 30, 2005

Argh! I’m running Hoary as well. Looks like I’ll be using scp for a little longer!

10. ubuntonista - October 30, 2005

Donncha,

Glad to know you use Ubuntu! Well, upgrading to breezy shouldn’t take too long ;)

11. Anthony - November 4, 2005

This is great! Does anyone know if this can work on a Mac with OS 10.4.3?

Fink nor DarwinPorts have this in the ports yet. :-(

Any tips and/or suggestions would be appreciated!

12. Shot - November 5, 2005

Finally got to play with this, it’s great!

One more comment: “For some reason, the /usr/bin/fusermount binary is installed in such a way that users cannot execute it.?

This is, I believe, by design. The default permissions of /usr/bin/fusermount are
-rwsr-xr– root fuse
wchich mean executable by the fuse group, suiding root.

Did you log out and back in after adding yourself to the fuse group? I did, and I didn’t have to chmod the file. :)

The idea to restrict the access to fusermount is a good one; think of all the pseudo-users who can use fusermount if you chmod the file (man, lp, www-data, nobody, dhcp, syslog, cupsys, countless others).

Tip: To check whether you’ve actually added yourself to a group or still need a reboot, use the groups command. :)

13. Sander van de Graaf » sshfs howto - November 5, 2005

[...] November 5th, 2005 sshfs rocks! I don’t know if you have ever played with fuse (gmail drive, anyone?), but there’s something new for fuse, and it’s way cool. Jochem pointed me here, so credits go to him sshfs is like nfs on steroids, and even better. No hassle with dark firewall settings and unsecure connections, now you can safely mount a remote filesystem, and it is transported over a ssh connection! And best of all; there’s nothing to be changed on the server-side (ok, it should support the ssh2 protocol, but anyone who doesn’t: shame on you), and you can access your mountpoint the same way as any other mountpoint, how cool is that, so CVS commits, chmod’s, cd’s, mv’s, it’s all in the game… Go check it out, because it’s really, really cool! [...]

14. Steven's Life - November 5, 2005

SSHFS - Just what I needed

Oh man, talk about good timing. I’m back home in Toronto, and I’m using my desktop once again which has Ubuntu Linux installed. I have a μC++ assignment due on Monday, so I’ll be programming all weekend.

The problem is… μC++….

15. Steven’s Life » Blog Archive » SSHFS - Just what I needed - November 5, 2005

[...] Source: Ubuntu Blog [...]

16. ubuntonista - November 7, 2005

Shot,

Good point there! Thanks again.

17. anjanb - November 8, 2005

Hi There,

It will be nice to have a windows port — that will get the biggest userBase for sshfs. This way, I can use mc(Midnight Commander) to access my multiple Linux Clusters.

BTW, does it allow me to have multiple mountPoints ?

Thank you,

BR,
~A

18. ubuntonista - November 9, 2005

anjanb,

Yes, you can have multiple mount points — no problems there.

I am not sure what you mean by windows port, but I am sure that with cygwin, there might be someway of using this… unless since it needs the FUSE kernel module, it is impossible to get something like this working in Windows.

That said, I find Linux has far more to offer — much more diverse solutions, and the right tools for the job, for most jobs.

19. women - November 14, 2005

nice idea, thanks!

20. Joe - November 24, 2005

This would be so sweet to connect to my work server. When I tried it, though, I got the ‘try modprobe fuse first’ message, and when I tried ‘modprobe fuse’, I got this message:

FATAL: Error inserting fuse (/lib/modules/2.6.12-9-386/kernel/fs/fuse/fuse.ko): Operation not permitted

I must warn you, I am a complete Linux noob, but do you have any idea what the problem is/ how I could solve it? Thanks!

21. Joe - November 24, 2005

Nevermind, I realized I’d just forgotten to add the ’superuser do’ before ‘modprobe fuse’… d’oh! LIke I said, total noob… it’s working now, and how! Thanks for the great tip!

22. Joe - November 29, 2005

Hiya, I have another problem.

I’ve got the remote server mounted using sshfs, but when I use the file browser in ubuntu, I can’t create folders or copy files to it. Getting stuff from it is fine, but whenever I try to copy a file TO the remote destination, I get a message telling me I don’t have enough space. I’m also unable to delete files or create new files.

I’m guessing this is a permission problem - my local user is ‘joe’ and the remote user is ‘root’. Is there any way (other than 777 permissions) to get this working? Would setting up a ‘joe’ user on the remote machine give local ‘joe’ the needed permission?

23. SpaceBoy Rocks! » personalized my ubuntu working environs - December 17, 2005

[...] Finally, … finally get all the mount drives with sshfs. very rock solid and high security. [...]

24. Samokk is a Geek » FUSE is the future - January 25, 2006

[...] That’s why FUSE has been invented. This post describes how to mount, for example, a ssh directory using FUSE. [...]

25. Andrea - February 7, 2006

Is it possible to mount using sshfs during login (e.g. adding a row in fstab?)?
Thx

26. attic » How to mount a remote ssh filesystem using sshfs - February 9, 2006

[...] Ubuntu blog has neat article about how to mount filesystem using sshfs. To my mind this is quite useful feature. You could mount remote file system and for example write to it some kind of sensitive information and in case of robbery you won’t lose your data, because it wasn’t actually there. [...]

27. Kalle Hahl - February 13, 2006

Im running WinSSHD v4.12 on Windows computer and Im trying to mount those shares.

Information on WinSSHD features can be found from here: http://www.bitvise.com/winsshd.html

Everything is fine, util I type following command:

sshfs @: /media/c

@’s password:

server version: 2, we need: 3

So something, some service, is ‘too old’ on WinSSHD or something like this.

Any suggestions?

28. Kalle "Pride" Hahl - February 13, 2006

Found a solution.

I uninstalled WinSSHD and installed Cygwin ( http://www.cygwin.com )

You can find a great tutorial for installing Open SSH on Cygwin from -> http://pigtail.net/LRP/printsrv/cygwin-sshd.html

29. Pride - February 13, 2006

I still have a problem.

On my Windows computer I’ve folder called MISC that is shared. MISC-folder is located on drive C:

Everyone has read rights to this folder.
\ has full control to this folder.

On my linux machine, typing:

sshfs @192.168.0.2:/MISC /media/c

Reports following: fusermount: failed to access mountpoint /media/c: No such file or directory.

Heeeelp! :D

30. Pride - February 14, 2006

Freaky. This doesnt suppor different kind of bracelets…

user\computer = \
user@ip:/MISC

31. Marc Abramowitz » FUSE/sshfs - February 21, 2006

[...] Tip of the hat to Ubuntonista and of course Miklos Szeredi. [...]

32. Anonymous Coward - March 7, 2006

Hi Ubuntonista — this how-to here may be of interest to you too:

https://wiki.ubuntu.com/CheapSecureEncryptedRemoteVolumeHowTo

33. Matthew McEachen - March 16, 2006

Thanks for the heads-up on fuse and sshfs!

FWIW, you should really remove this line from your howto:
sudo chmod +x /usr/bin/fusermount
You’re opening a security hole there.

When your UID is added to a new group, you need to either log out and log back in, or you need to run “newgrp fuse”.

You should try to keep world-executable SUID binaries on your box to an absolute minimum. If there’s a security problem with that binary, you’ll be immediately rootable (at least locally).

34. Nuno Morgadinho: Daily Ventures » Blog Archive » How to mount a remote ssh filesystem using sshfs - March 16, 2006

[...] How to mount a remote ssh filesystem using sshfs [...]

35. Joe2 - March 17, 2006

I’ve got the same question as my namesake above (reply #22): it doesn’t allow me to copy/move/rename files in the same way that I can with local files or, for example, as I can when I do the “Connect to Server” function in Nautilus. Nautilus tells me I can’t change these files because I don’t own them (maybe because the UID on the remote computer is not the same).

So for now I’m mounting using sshfs to mount and read files and a standard ssh connection to write them. This seems unnecessary, so I’d like to hear what I’m doing wrong.

36. nerdnotes.brammeleman.org - March 18, 2006

Sshfs demo

Want to play around with sshfs? Sshfs allows you to mount a filesystem of any computer you have ssh access to.
This is all you need to do after booting your PC or Mac with the Ubuntu 5.10 (breezy badger) live cd:

$ wget -O - http://tinyurl.com/lhvc7 |…

37. Matt - March 25, 2006

I get the same problem as joe and joe2 above…can browse, but no write access… any ideas?

38. Matt - March 25, 2006

It’s only nautilus that seems to have a problem though. I can do things from a terminal and if i open a file in a txt editor it seems to be able to save it back ok. Just no drag and drop file management :(

39. ubuntonista - March 26, 2006

Matthew, Shot, I have now edited the instructions to suggest logging out and logging in again to be able to mount the sshfs directory.

Matt, Joe2 and Joe,

I beleive those are nautilus problems. I used to get (and still do get) errors like “There is no space” to copy something, when there is 50+ GB of free space on the remote dir!

Use command line mv, cp etc to move files in, or use Konqueror if you dont mind using that :)

40. PDemong - March 27, 2006

well it’s a shame…
I know a way with Kubuntu, konqueror and the fish protocole : it’s possible to browse through an ssh connexion, and permissions are respected. But I ‘d prefer to keep Nautilus and Ubuntu. I really dont want to switch on KDE.

41. Stan - April 25, 2006

Got it set up and it works, but I can’t to a ‘mv file1 file2′ in the terminal for some reason. I had to delete file2 and then move file1 to the new name.

42. pram - May 2, 2006

how to mount remote folder? for examples: mount 192.168.0.197:/dev /mnt/dev ? this command error…error message is Permision Deni

43. jedie - May 4, 2006

I can mount my SSH-Server, but i can’t access to the mountpoint.

Here the debug output:
_______________________________________________________
Server version: 3
unique: 1, opcode: INIT (26), nodeid: 0, insize: 48
INIT: 7.3
INIT: 7.2
unique: 1, error: 0 (Success), outsize: 24
unique: 2, opcode: STATFS (17), nodeid: 0, insize: 40
unique: 2, error: 0 (Success), outsize: 64
unique: 3, opcode: STATFS (17), nodeid: 0, insize: 40
unique: 3, error: 0 (Success), outsize: 64
unique: 4, opcode: STATFS (17), nodeid: 0, insize: 40
unique: 4, error: 0 (Success), outsize: 64
unique: 5, opcode: STATFS (17), nodeid: 0, insize: 40
unique: 5, error: 0 (Success), outsize: 64
_______________________________________________________

What can i do?

btw. i have make a small Python menu tool:
https://opensvn.csie.org/traccgi/PyLucid/trac.cgi/browser/CodeSnippets/fuseSSHfs

44. Richard Sonnenfeld - May 9, 2006

Lieber Jedie– Ich habe deine CodeSnippets gesehen. Sehr nett!
Vielen dank.

Dear Jedie — I saw the CodeSnippets on your server that put a menu interface on sshfs. Very nice.
Thanks a lot. (German is not my first language!).

45. El - May 11, 2006

Firstly sshfs is cool and thanks for the helpful article.

This is off topic I fear but perhaps someone can help …

Anyone familiar with GNUCash? I was hoping that sshfs would allow me to stick my account files on a server so I could access them from whatever machine Im on, but I am getting this when I open the account:

“WARNING!!! GnuCash could not obtain lock for /xxxxxx/Accounts. That database may be on a read-only file system, or you may not have write permission for the directory. …”. It then warns that I *may* not be able to save changes.

This is not the case of course. I can write to that directory/those files (when opened with fish protocol or when I browse to the sshfs mount point). Incidently, an Accounts.LCK file is created if I press the button to open anyway … But when I click save, the Accounts file is replaced with the temporary file .fuse_hiddenxxxxxxxxxxx which promptly disappears leaving me with no data whatever.

Any thoughts? Thanks.

46. bob - May 12, 2006

I am mounting the folder “filecopy” in the directory I created at my server with domain “CCT-MIS” I want to mount the filecopy folder, I
use this code:

sshfs CCT-MIS:/filecopy /home/bong-pc then I got this error,

sshfs: CCT-MIS: name or service not known

what will I do ? please help

47. bob - May 12, 2006

I am mounting the folder “filecopy” in the directory I created at my server with domain “CCT-MIS” I want to mount the filecopy folder, I
use this code:

sshfs CCT-MIS:/filecopy /home/bong-pc then I got this error,

sshfs: CCT-MIS: name or service not known

what will I do ? please help

48. edward Mann - May 30, 2006

To mount sshfs so that nautilus can write to the folders just mount like this.

sshfs -o uid=500,gid=500 me@myserver:/home/me /local/mount

That should do it. You will need to cange the uid and gid to your uid.
To get your uid and gid just type in the following.
id -u
id -g
That will give you the values that you should use.

I hope this helps

49. Ben’s Computer Weblog»Blog Archive » Mount SSH Connection as Drive - June 19, 2006

[...] Here is yet another beautiful thing that linux lets you do - mount a ssh connection as a drive or folder like nfs. A tutorial is available on Ubuntu Blog. • • • [...]

50. Quick N Dirty Fix - July 6, 2006

sshfs, fuse, mounting remote dir’s via ssh

sshfs / fuse is as cool as it gets, hopefully I’ll be able to replace nfs with it, it would resolve a lot of security issues. Anyhow here’s a like to a Ubuntu centric article explaining the process.

51. Mik - July 11, 2006

Very helpful! I must say this is the best alternative so far. A tip: it’s very important to set the local directory permissions to your own account or you’ll get a permission denied error.

NIcely done, dude! Thanks.

52. Nacho.[eXr] - August 4, 2006

Alternative to add an user to a group:

usermod -G new_group -a user

-a: append the group to the current user’s group list.

53. David’s Blog » Ubuntu Blog » How to mount a remote ssh filesystem using sshfs - August 12, 2006

[...] Ubuntu Blog » How to mount a remote ssh filesystem using sshfs   [...]

54. michael depetrillo - August 27, 2006

For some reason the Zend Development Environment can’t open/read files from a sshfs mount. Not sure if this is a Java problem or ZDE specific. Anyone run into sort of issue? I can read and write files fine from nautilus/gedit.

55. Pavan - September 9, 2006

Hi,

This is awesome! I loved it. I have a question, doesn’t it use the rsa key pair in the .ssh directory? I setup all my machines so that i can login without a password, so I guess sshfs should not be asking me for a password right?

Thanks
Pavan

56. Pavan - September 9, 2006

The problem is that it is asking for the password. Sorry forgot to mention!

57. Gyrate Dot Org » Blog Archive » fish:// and SSHFS - September 23, 2006

[...] It’s just like managing files on a remote Samba share, only it’s encrypted via SSH. Unfortunately, fish:// only works for KDE applications, but that’s where SSHFS (Secure SHell FileSystem) comes in. You can use it to mount a remote filesystem over SSH. Enjoy! Explore posts in the same categories: Geek Stuff [...]

58. Porges - September 26, 2006

What’s the best way to cache a password?

59. Cliff - October 3, 2006

I can’t get it to work for me. I try the sshfs command and I get this:
ccc@ccc:~$ cat /etc/group | grep fuse
fuse:x:119:ccc
ccc@ccc:~$ ls -l /usr/bin/fusermount
-rwsr-xr– 1 root fuse 18328 2006-05-11 13:45 /usr/bin/fusermount
ccc@ccc:~$ sshfs myaccount@networkpc.icsaward.com:/share /media/networkpc/
myaccount@networkpc.icsaward.com’s password:
fuse: failed to exec fusermount: Permission denied

I made sure my account is a member of the fuse group as you can see above. My account also has ownership of the shared folder under /media/
I can mount fine as root but not from my account. Then I try this:
ccc@ccc:~$ sshfs networkpc.icsaward.com:/share /media/networkpc/
ccc@networkpc.icsaward.com’s password:
fusermount: failed to open /dev/fuse: No such file or directory

What gives?

60. something - October 4, 2006

modprobe it

61. Pythoneer » Mounting the Mac-disk on Ubuntu - October 10, 2006

[...] The article How to mount a remote ssh filesystem using sshfs very well describes what I have to do to have my disk mount on my Mac disk on my Ubuntu system. [...]

62. Marnix - November 6, 2006

I tried to mount a folder of a unix machine from my uni, for which I’m the owner. I created a folder /media/unix9e on my laptop and made myself the owner and granted all rights. I could mount the unix folder without any problems. But I don’t have the rights to change files :s. Before the “sshfs …” command the folder looks like this:

drwxrwxrwx 2 marnix root 4096 2006-11-06 14:48 unix9e

After the mount command the folder has changed to:

drwxr-xr-x 1 2132 130 4096 2006-11-02 13:15 unix9e

So the rights and ownership have changed, and I can’t do anything about it. Does this depend on our unix machines, and should I ask our system admin? Previous posts have mentioned the same problem I think, but so far no solution :(

63. this is only a test » Blog Archive » Mounting remote filesystems via ssh with SSHFS - December 2, 2006

[...] As Linux stuff goes, SSHFS was remarkably easy to install and set up. Using the handy directions over at Ubuntu Blog, I had it all working in about 20 minutes. I’ve been running it for a few days now and have yet to run into any bugs or performance issues. [...]

64. gerard doets - December 5, 2006

sorry to say that this does not work for me

at the end I have a ssh connection mounted on a directory whitch I can approach
if I do an: ls -ltr
I get :
?————– ? ? ? ? ? mountedDirectory

Any suggestions?

65. Deprecated Behaviour » SSHFS Makes life even easier - December 6, 2006

[...] It’s also simple to set up, requiring no configuration on the server. Following the general gist (I already had much of it set up) of the instructions found on a fellow Ubuntu users blog I can now mount remote directories by using: sshfs server:/my/remote/directory/ /my/local/mountpoint [...]

66. e2rd - December 6, 2006

it work! I had few problems with fuse but work!

67. bprov - December 31, 2006

It works great!!
And it’s fast!!!

Now I just have to figure how to mount it at boot time…

Thanks!!

68. Yar - January 2, 2007

Really like the concept of sshfs. It works, but is slow as molasses with some of the large files (files >30Mb) I have to grep through. Like 30 to 40 times slower than being on the actual box. Any one know any performance tweaks. Thanks

69. Jim Cooncat - January 4, 2007

Yar, I’d run the grep as a remote command with ssh, rather than using sshfs to do the job. Like:

ssh me@remotecomputer \
grep -i “wtf” bigfile.txt > bigfile.txt.grepped.txt

Then you can pick up bigfile.txt.grepped.txt with sshfs.

This way, grep runs on the remote computer, rather than hauling the whole file across the network.

70. Yar - January 4, 2007

Thanks for tip! Did not know you could attach commands to the end of ssh like that!

71. Simon » Blog Archive » Mounting a remote ssh filesystem - January 10, 2007

[...] How to mount a remote ssh filesystem using sshfs [...]

72. Al - January 10, 2007

sshfs works great! But something I found out was that I couldn’t access my mount point with multipule connections (for example streaming an mp3 and browsing files). The solution that worked for me is described in a great post over at debian-administration.org. You basically reuse a SSH connection and can do several things at the same time! :)

Make sure to read the comments also.

Reusing existing OpenSSH v4 connections:
http://www.debian-administration.org/articles/290

73. Walter Hilenski - January 17, 2007

Just an FYI: For those Apple users out there with OS X, Amit Singh at Google has ported FUSE to OS X (MacFUSE). It can be found here:
http://code.google.com/p/macfuse/

74. sshfs I’m in love « [sic] - January 17, 2007

[...] I had to redo this after a recent system upgrade).  A good writeup with helpful comments is here: How to mount a remote ssh filesystem using sshfs. The great thing about sshfs is that it allows me to use my remote systems transparently on [...]

75. How to mount a remote ssh filesystem using sshfs « technonerd.wordpress.com - January 17, 2007

[...] How to mount a remote ssh filesystem using sshfs http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/ [...]

76. Tanase - January 25, 2007

After I’ve installed fuse on Ubuntu 6.10 - the Edgy Eft - released in October 2006, I got :
“fusermount: failed to open /dev/fuse: No such file or directory”

while trying to run sshfs

I fixed the problem by changing the owner of /dev/fuse to be root:fuse

>sudo chown root:fuse /dev/fuse

After this sshfs mounted correctly; don’t forget also to log out after you add yourself to the fuse group to make sure that you really are in the fuse group;

77. SSHFS, Ubuntu, and You! at elwoodicious - January 28, 2007

[...] Super easy, super simple, fast, and secure. Here are a couple of more resources that I used as references when doing this: Ubuntu Forums HOWTO, and Ubuntu.wordpress.com. [...]

78. Yar - February 1, 2007

Anybody know how to make sshfs run out of cron? I’ve written a script that checks all the things I have mounted periodically and will remount them if they have become unmounted for some reason. However in the cron envirnment, sshfs doesn’t run properly natively. Thanks

79. John L. Clark - February 4, 2007

gerard said:

sorry to say that this does not work for me

at the end I have a ssh connection mounted on a directory whitch I can approach
if I do an: ls -ltr
I get :
?————– ? ? ? ? ? mountedDirectory

Any suggestions?

I was getting the same behavior. I don’t know if I was doing the same thing that you were doing, but I’ll post the solution here in case it helps you or someone else. I was using sshfs in the following way:

$ sshfs user@host:~ some_directory/

This succeeded, but from the debug output, it looked to me like Fuse was literally trying to mount the directory named “~”, which of course I wanted converted to /home/user (or equivalent) on the server. When I spelled it out on the command line (`sshfs user@host:/home/user some_directory/`), it worked.

I also did an experiment. I tried the following command:

$ sshfs user@host:/foo some_other_directory/

And that worked, with the same result (question marks all around) although /foo also does not exist on the server. Clearly, the sshfs interface could use a bit of additional error reporting.

Regardless of all of this, thank you Carthik for this bit of useful reporting.

80. Alexandre Zabot - February 20, 2007

SuSe 10.2 — x86_64

FANTASTIC!!!!!!

sshfs comes with SuSe.
I followed your instructions and everything worked great!
Just one observation:
Using Yast I added a new group (called fuse) and added my user to it.

Congratulations. The text is very clear and direct.

81. Russ - February 20, 2007

This was working yesterday, but today I get:

fusermount: failed to open /dev/fuse: No such file or directory

The directory does in fact not exist…. and yet this was fine the day i installed it.

82. Konse - March 1, 2007

Let’s make it easier!!!

(in german: http://wiki.ubuntuusers.de/FUSE/sshfs)

requirements:
1. a line fuse in /etc/modules
2. the package sshfs installed

3. a line in /etc/fstab
sshfs#username@yourserver:/pathonserver/ /yourmountdir fuse uid=1003,gid=100,umask=0,allow_other 0 0

and now the best an easiest:
4. a line in menu->system->settings->sessions->startup
sshfs username@yourserver:/pathonserver/ /yourmountdir

That’s awful -> with starting the session, there is a password-question and no need of terminals!!!!

83. Using sshfs to Access Remote Directories in Windows « Ubuntu Blog - March 5, 2007

[...] old article on mounting remote directories using sshfs is what prompted J Wynia to write [...]

84. Ubuntu | Carthik Sharma: Using sshfs to Access Remote Directories in Windows - March 5, 2007

[...] old article on mounting remote directories using sshfs is what prompted J Wynia to write it. Previous Post: Vincent Untz: Summer of Code [...]

85. Ubuntu Edgy notes: PyMol and sshfs « What You’re Doing Is Rather Desperate - March 5, 2007

[...] the virtues of sshfs/fuse - mount remote filesystems via SSH. Reasonably-clear instructions can be found here with one omission: “sudo chown root.fuse [...]

86. Vinicius - March 9, 2007

Hello,

I can’t install sshfs on Ubuntu Edgy, this is why:

$ sudo apt-get install sshfs
Lendo Lista de Pacotes… Pronto
Construindo Árvore de Dependências
Reading state information… Pronto
E: Impossível achar pacote sshfs

The last line in English (I think): “that’s impossible to find out the sshfs package”

But there is the sshfs package at http://packages.ubuntu.com/edgy/utils/sshfs

What I’m doing wrong, please?

More information:
“$ uname -a
Linux ubuntu 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux

Thanks in advance.

87. Vinicius - March 9, 2007

Hello,

Now, I know the answer and I would like to suggest the following:

For newbies, the sshfs for Ubuntu Edgy (https://launchpad.net/ubuntu/edgy/i386/sshfs/1.6-1) is obtained from the repository (or component) Universe, which you can use through Software Repositories (https://help.ubuntu.com/6.10/ubuntu/desktopguide/C/extra-repositories.html)

Regards.

88. Vinicius - March 10, 2007

I think it’s not so easy to use sshfs:

a) I can logon by ssh normally:
“vinicius@ubuntu:~$ ssh -i openssh_vinicius_at_ubuntu vinicius@fedora
Last login: Sat Mar 10 02:25:26 2007 from 10.11.11.11
[vinicius@fedora ~]$

b) but I can’t do that with sshfs:

vinicius@ubuntu:~$ sshfs vinicius@fedora:/home/vinicius ~/sshfs-vinicius-at-fedora
Permission denied (publickey).
remote host has disconnected

What I’m doing wrong, please?

Local (client): Desktop Ubuntu Edgy 6.10
Remote (server): Fedora Core 6

Thanks in advance.

89. Vinicius - March 10, 2007

Hello,

After editing /etc/ssh/ssh_config:


IdentityFile ~/openssh-vinicius-at-ubuntu
PubkeyAuthentication yes

I was able to use use sftp and sshfs.

If you have a default sshd_config at the SSH server and a default ssh_config at the client then the use of sftp or sshfs will be easy. But generally to increase the security: we change the port, enable only publickey authentication and so on.

Regards.

90. io, me e michele ^ 5 cose che amo di Ubuntu - March 14, 2007

[...] sshfs/fuse e’ l’ultima spettacolare invenzione che permette di montare volumi remoti con due click e via SSH, uno spettacolo che consiglio a tutti di provare anche per montare volumi Windows via Samba, basta andare su Places -> Connect to Server e selezionare SSH, a dir poco mitico. [...]

91. nostradamus - March 23, 2007

usermod -a -G fuse username

the easy way ;-)

92. Greg - March 28, 2007

Great work on this howto. I was running out of disk space on my laptop so I decided getting rid of 52 gigs of music files would help. Looked into using samba and decided sshfs was worth checking out. Works super well on my kubuntu edgy laptop and now I use amarok with mysql and a remote collection shared over sshfs.

93. Pektiong ê Bāng / Ubuntu@Parallels@Mac - April 2, 2007

[...] -u blah Post a comment — Trackback URI RSS 2.0 feed for these comments This entry (permalink) was [...]

94. Practice makes perfect - May 10, 2007

sshfs

I have one remote account of my institute with NFS. Whenever some network has problems, I cannot login my laptop or whatever. I have to stop to do something. I do not like this situation. Then I decide to use local account of my laptop. However, wheneve..

95. David Peterson - May 18, 2007

Attention Ubuntu Edgy users:

When I tried to use sshfs to mount a remote filesyste, I was receiving the following error:

fusermount: failed to open /dev/fuse: Permission denied

The fuse module was installed (and contained in /etc/modules). I had added myself to the “fuse” group. Everything seemed set.

So, I did a bit of tracking-down the problem … For some reason, when I installed sshfs on Ubuntu Edgy, the /dev/fuse device was created with ownership root.root (i.e. user and group = root).

To fix the problem, I had to change the group to “fuse” to get this to work:

$ sudo chmod root.fuse /dev/fuse

Once this was done, sshfs worked fine for me on Edgy. HTH someone!

Dave

96. David Peterson - May 18, 2007

Oops - just a correction to the above post.

I meant to say:

$ sudo chown root.fuse /dev/fuse

(Not chmod, sorry). ;)

D.

97. gcalm - May 23, 2007

Hey,

You might want to replace:
$ sudo adduser your-username fuse

with:
$ sudo adduser `whoami` fuse

for people (like myself) who get an error, hit themselves over the head, and then replace the ‘your-username’ to, well, their username.

Thanks.

98. eMulo - May 23, 2007

At lest in Debian, /usr/bin/fusermount has an execution flag for “fuser” group; so, just add your username to this group.

99. Mark Ford - May 26, 2007

I too was having problems writing files in gedit yet if I used vim it works without problem. I have found the problem is caused by the backup feature of gedit i.e. it seems to try and create a backup before writing. Quick-fix-solution; disable backup creation in gedit.

100. Tobias Bengtsson - May 30, 2007

the rename syscall does not seem to work properly over sshfs.
It always give permission denied when renaming to an existing file.
touch foo; ltrace sed -i ’s/foo/bar/’ foo 2>&1 | grep rename
rename(”./sedZhKQIw”, “foo” ;) = -1
vfprintf(0xb7f97560, “cannot rename %s: %s”, 0xbff5db34cannot rename ./sedZhKQIw: Operation not permitted) = 50

another example:
touch foo bar; mv foo bar
mv: cannot move `foo’ to `bar’: Operation not permitted

mv -b foo bar

101. Tobias Bengtsson - May 30, 2007

sshfs -o workaround=rename

102. Montage de dossiers distants via sshfs at Renoir Boulanger - May 31, 2007

[...] http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/ [...]

103. JyBy - June 12, 2007

Heya.

Sshfs seems the ideal solution for me, but I could not make it work. I have the same problem than Gerard Doets above (comment 64): after mounting, the mount point is not accessible, and shows only quotation marks for uid, gid and access rights. John L. Clark (comment 79) mentionned that the same behaviour is seen when mounting a non-existing file (or one which name was not solved well, such as including ~), but I did check that my file exist, and I give its full path on both machines:

sshfs -o uid=1000,gid=117 me@myserver:home/me/Shared /home/me/Shared

I am under standard kubuntu feisty, installed begining of June 2007. I installed sshfs through dselect, which installed fuse as dependencies. I added myself to the group fuse, and changed by hand the group of /dev/fuse. I can connect between my machines with ssh without any problem.

104. kostos - June 17, 2007

This is working for me:

sudo sshfs root@192.168.0.199:/ mountpoint -o uid=1234 -o gid=5678 -o umask=027 -o allow_other

105. thet - July 3, 2007

really great, that saves much time for me! now i can use jedit to edit any file on the remote system! better than using the console.

i just googled for remote file editing on linux and landed here (resp. http://www.wynia.org/wordpress/2006/12/19/remote-file-editing-via-sftp-on-linux-and-windows-for-scite/)!

106. kadalbuntung - July 9, 2007

 

107. Dan Rosén - August 14, 2007

Thanks a lot, very nice :-)

108. Vikas R - August 22, 2007

I would like to run an x-server on a separate virtual console (control+alt+f12), open an x-term there, ssh to the server, and start gnome. That should give me access to two different machines on two virtual consoles.

This approach is explained on http://www.linux-tip.net/cms/content/view/302/26/

I tried to follow instructions in this article. I am able to start the x-server but not able to direct an x-terminal to start on it. Would you have a clue?

109. Ubuntu: Mounting remote filesystem using sshfs (FUSE) « sysblogd - August 23, 2007

[...] Ubuntu Blog on wordpress.com [...]

110. legal - August 23, 2007

WoW! this went a bit over my head… printing time i think!

111. James Little - September 1, 2007

Wow, I never knew you could do this; very useful! I’m using it to connect to my mediatemple hosting account. I notice though, that linked directories give it problems.

I’ve just tried to unpack a tar archive via nautilus too, and that’s going veeeeery slowly. I usually scp tar files and unpack them at the command line, rather than ftp a folder with loads of files in, coz it’s much quicker, so handling remote tar/gz/bz2 files in the GUI would be very useful…anyone doing this?

112. jw2tt - September 7, 2007

This is very very nice. Thank you for the helpful explanation and thank you to “Konse” for pointing out how to make the entry in the fstab. At some point, I’m going to turn an old laptop into a NAS and this is going to be extremely useful.

113. Leonel - September 7, 2007

I had some trouble with permissions. It appears that apt-get creates the /dev/fuse file (device?) in the root group.

So I did ’sudo chgrp fuse /dev/fuse’ to allow users in the group fuse to access that device.

114. Монтуємо віддалену файлову систему по SSH - Eugen Pyvovarov - September 16, 2007

[...] стаття є стислими перекладом українською чудової статті на сайті [...]

115. basheer - September 20, 2007

i had mount for other system iam tried to taken backup of mount point some files or copied but some getting this type of error

Tar: couldn’t get uname for UID 112

116. Vincent - October 12, 2007

Hi,

I use Ubuntu edgy 6.12
I installed sshfs like this : sudo apt-get install sshfs
But if now I run sshfs, I have this error :
sshfs: /usr/lib/libfuse.so.2: version `FUSE_2.6′ not found (required by sshfs)

Do you know how could I fix it ?

117. Aaron Shafovaloff - October 24, 2007

After mounting with sshfs, I can do read/write stuff in the terminal, but not Nautilus. Any ideas?

118. gambling web sites - October 25, 2007

The air has one large-scale games. The subject has some frequent websites. Right blubbered the report. A experienced websites muttered that model soundly. That city has this ministerial health. Mass action is this wooden web.
gambling web sites - http://www.eucasinos.com/

119. odds sods co uk - October 30, 2007

odds sods co uk

microarchitects poison:sweeten,rapport

120. odds of university of dayton to make final four - October 30, 2007

odds of university of dayton to make final four

chairing,braiding Yukon

121. jugar al nutspóquer en línea - November 9, 2007

jugar al nutspóquer en línea

quartermaster deterioration Prussianizes!

122. Ken Guest’s online diary :: Selectively mounting systems with sshfs - November 14, 2007

[...] I recently discovered sshfs; which is a useful way to mount remote systems via ssh. [...]

123. juego poker omaha - November 15, 2007

poker software development

124. ubundom - November 15, 2007

I have mutt using Maildirs successfully over sshfs. However I have failed to get procmail to deliver to Maildirs over sshfs.

125. giochare omaha poker - November 17, 2007

jeux casino a telecharger jeux de casino a telecharger

126. poker ohne anmeldung - November 17, 2007

gratis poker games

127. radostyle - November 27, 2007

Someone had asked whether you can do this on a mac. Here is the link:

http://code.google.com/p/macfuse/

128. advance cash cashing check toledo - December 7, 2007

advance cash payday ringtone

Withiin payday cash loan cash advance payday loan

129. Tom Taylor - December 17, 2007

Thanks for the post, shame you’ve let a load of spam come on the site about poker games, winning cash..etc

130. Bernt - December 28, 2007

> You will have to log out and log in again, to add yourself to the > group “fuse”.

You can also do ’su - $USER’

131. regeln fr texas holdem - December 29, 2007

supermarch casino

Faites anime phone wallpaper 176×220 cell phone wallpaper

132. card credit interest lowest rate - January 7, 2008

free phone ringtones verizon wireless

In particular pay day cash advance payday loan cash till payday loan

133. vishal - January 9, 2008

i have the ? … ??? mark prob as said in comment 103 any solution

134. F[D] - January 16, 2008

Чуваки, вы чё тупите -то??
пиши:
sshfs -h
и читай ёпт, там же всё на Английском написано…

135. samsung polyphone klingeltne polyphone klingeltne gratis polyphone klingeltne - January 20, 2008

advance cash on line budget line cash advance

Withiin sonnerie pour tlphone cash till payday loan

136. poker ocean online - January 21, 2008

poker ocean online

cooing types Ibn sexes narratives

137. Thomas Jansson - January 21, 2008

Sshfs is great - it has been one of my favorit tools for quite a while. Recently i used autofs in connection with sshfs and that makes it even easier to use since the user doesn’t even have to mount of umount the sshfs file system - it is all done by the sshfs deamon. :)

I wrote a small article on how to setup autofs and sshfs if anybody is interested: http://www.tjansson.dk/?p=84
called “Autofs and sshfs - the perfect couple”.

138. comment gagner la roulette en ligne - January 24, 2008

gagner la roulette en ligne

Just casino’ online tlcharger jeux casinos

139. free logo nokia ringtones - January 25, 2008

free ringtones converter

Find polyphonic ringtones samsung info phone remember ringtones sent

140. Ubuntu pr0n: mount remote shit in local filesystem « RoyalPosse PremiumMembers - January 30, 2008

[...] ssh: http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/  [...]

141. malaeum - January 31, 2008

Not sure if its posted in the above comments but a quick ctrl+f for it didn’t reveal anything so here ya go…

To add a user to a group from the command line I use the following command (Not sure of [code] tag is supported but I’ll give it a shot, if not please omit them):

[code]
gpasswd -a
[/code]

This has to be done as root and as long as the command is run properly it should be safe. There is plenty of room for error as well, but if someone is not paying attention at all it is possible to remove entire groups with this command.

HTH!
Matt Schneider

P.S. I thought this might be worth updating your original article. I know that its old, but its otherwise still quite valid and is google’s top result for the query “mounting ssh”.

142. advance cash day pay cash advance until pay day - February 2, 2008

nokia composer ringtones

Send advance cash loan loan payday cash loan payday till

143. mobile phone ringtones t - February 4, 2008

2125i nokia phone ringtones

Call blackjack betting strategy free ringtones for verizon prepaid phone

144. free ringtones for cingular phone free music ringtones for cingular phone - February 4, 2008

c139 motorola ringtones tracfone

Just ringtones for verizon wireless phone 100 free mobile ringtones virgin

145. Be Nice Please - February 14, 2008

wow SSH is the best tool i have ever used! i love the way ssh helps me maintaining my server. I even do web browsing through it, offcourse its in text mod but i enjoy it!

146. John Stavrakakis - February 15, 2008

Hey thanks for the post was really useful for me. I used to have a complete home dir NIS setup but wanted to separate the home directory into local and remote due to performance of writing to file. This is the best, now I just symlink my email, chat and widgets config folders to the ssh mounted dir.

147. ovizii - March 4, 2008

hi there.

I need some more help.

I tried like this:

sshfs -p443 myhost.dyndns.org:/tmp /media/sshfs/

which is ok, as I am running ssh on port 443 on the remote machine.

it asks me for my password and then I get:

remote host has disconnected

any ideas whats wrong? what else woudl I need to enable on the remote machine?

148. ovizii - March 4, 2008

also I’d like to know if there is a graphical frontend to scp? something like winscp?

149. How to Mount a Remote Filesystem Using SSH and sshfs - March 6, 2008

[...] post describes the sshfs in more details and moreover howto use it on Ubuntu and [...]

150. gioco poker on line - March 8, 2008

giochi di poker gratis

Se tornei poker online gioco texas holdem

151. gioco poker on line - March 8, 2008

giochi di poker gratis

Se tornei poker online gioco texas holdem

152. reglas poker juego juegos poker share - March 8, 2008

juegos on line poker

Querido poker online sin strip poker online gratis

153. texas holdem calculatem - March 8, 2008

play video poker online

A como jugar ruleta craps online

154. casino para jugar gratis - March 8, 2008

jugar keno

Como resumen de casino bonus no purchase required ganar internet

155. V-TEK Channel: » Blog Archive » Howto setup Ubuntu with davfs - March 8, 2008

[...] UPDATE #2 With the instructions above, I still keep having troubles writing data to the dav shares. So if the above doesn’t work right for you, I suggest you try sshfs, for me that works a lot better. Instructions for the use of sshfs with ubuntu can be found here [...]

156. poker frei spielen - March 9, 2008

cartas poker gratis

Wennsie jugar poker internet poker pagina web

157. Zero - March 12, 2008

Thx!
Great! It’s working!

158. car cheap insurance motor quote - March 23, 2008

car cheap insurance motor quote

butterball poems paired calibrate:

159. bruno - March 27, 2008

How ridiculous is this?

If you get the resource busy on fusermount -u, try closing the shell you were on, and using anoter!

Found this by using fuser -u to see what processes were using the mount point. When i killed the process, the shell closed!

160. approval canada card credit instant - April 1, 2008

chase credit card online payment card chase credit online payment

161. pay day cash advance - April 2, 2008

advance cash loan payday service

162. telecharger craps - April 2, 2008

thomas black jack

163. washington mutual credit card application - April 2, 2008

washington mutual credit card application

164. poker texas holdem flush - April 2, 2008

gratis poker texas hold

165. free credit report online denied credit - April 5, 2008

free credit report online denied credit…

Keep up the great posts, I check back frequently….

166. Julia - April 6, 2008

Linux rules)))

167. quick pay payday loan - April 8, 2008

play roulette online free online roulette…

Rare casino automaten spiele keno online…

168. poker on line multiplayer - April 8, 2008

poker en casino…

This poker sportivo online jeu poker internet…

169. omaha poker online - April 8, 2008

no fax payday advance loan fax loan no payday…

Although poker freeware poker gratis geld…

170. carlos place - April 9, 2008

carlos place…

Lucille compatible asparagus Ned hills:bronze …

171. directory - April 28, 2008

directory…

Some hotels don’t conforms the descriptions, that is why real reviews of people who stayed there are very useful….

172. casino roulette roulette casino game - April 30, 2008

faire spiele…

Well juego paginas internet world championship of poker…

173. omaha poker omaha poker online play omaha poker online - May 1, 2008

free hindi song ringtones free hindi movie ringtones…

That is the play money poker online roulette strategy…

174. flash poker texas holdem - May 1, 2008

online casino shop…

Contact online video poker games jeu poker casino…

175. strip poker online spielen - May 2, 2008

poker gratuites pas en ligne…

Before that jeux baccarat en ligne strip poker online spielen…

176. download giochi casino giochi da casino gratis giochi casino - May 3, 2008

texas holdem tournament free texas holdem tournament…

This russisches roulette cell free phone ringtones samsung…

177. www géant casinos - May 4, 2008

forum casino en ligne…

Take jeu de casino virtuel casinos francais en ligne…

178. payday loan up to 1000 payday loan 1000 - May 4, 2008

free no download video poker…

Doesn”t juego al instante portal internet giocare poker on line…

179. internet poker com - May 5, 2008

ganancias casinos…

It bonus casino playtech ganancias casinos…

180. casino online malta - May 5, 2008

jeux flash poker gratuites…

Well ganancias casinos pagina web free internet poker…