1 | See http://fuse.sourceforge.net/wiki/index.php/SshfsFaq for the latest |
---|
2 | version of this FAQ |
---|
3 | --- |
---|
4 | |
---|
5 | 1. I've found a bug and there's no solution in this FAQ, what |
---|
6 | should I do? |
---|
7 | 2. Why do permissions in nautilus not work! |
---|
8 | 3. Advantage of sshfs over NFS and Samba |
---|
9 | 4. Create the device node |
---|
10 | 5. =mv= fails with _"Operation not permitted"_. |
---|
11 | 6. cvs fails with "cvs [status aborted]: cannot get working |
---|
12 | directory: No such file or directory" in a sshfs mounted directory |
---|
13 | 7. Changes on the server are not immediately visible in the |
---|
14 | mounted directory. |
---|
15 | 8. Configuring the ssh connection |
---|
16 | 9. What are the =no_readahead= and =sshfs_sync= options for? |
---|
17 | 10. Why does =df= return strange values on partitions mounted via |
---|
18 | sshfs? |
---|
19 | 11. How do I specfy the remote mount point (since the example |
---|
20 | defaults to the home directory) |
---|
21 | 12. sshfs hangs after a while |
---|
22 | 13. Following symlinks on the server side |
---|
23 | 14. Making absolute symlinks work |
---|
24 | 15. Mounting as root |
---|
25 | 16. Exporting via NFS |
---|
26 | 17. Automatical mounting using /etc/fstab |
---|
27 | 18. Why does SVN (etc...) fail with permission denied? |
---|
28 | 19. Why does SVN (etc...) fail to rename files? |
---|
29 | 20. Is there some neat way to do it in reverse? |
---|
30 | 21. Might it be reasonable to disallow loops? |
---|
31 | 22. How to mount through an intermediary ssh server, eg: localhost |
---|
32 | -> A -> B; mount B from localhost |
---|
33 | 23. Alternative Solution: |
---|
34 | 24. I seem to have successfully mounted a remote directory, but |
---|
35 | performing an `ls -l` on the directory above the mount point shows |
---|
36 | the mount point's attributes as `? ? ? ? ? ?`. Nothing shows up in |
---|
37 | the directory either. What am I doing wrong? |
---|
38 | 25. What options do i use to make playing media files (music) over |
---|
39 | sshfs more efficient? |
---|
40 | 26. MacFUSE doesn't seem to let me move files from one directory |
---|
41 | to another. It first asks for my local user password (i.e. the |
---|
42 | password on my Macbook Pro) and then produces the error message |
---|
43 | "The operation cannot be completed because one or more required |
---|
44 | items cannot be found. (Error code -120). |
---|
45 | 27. How can I get procmail to open, read and write to remote |
---|
46 | directories over sshfs? |
---|
47 | |
---|
48 | (To sign in, put two capitalized words together: MyName) |
---|
49 | |
---|
50 | I've found a bug and there's no solution in this FAQ, what should I do? |
---|
51 | |
---|
52 | Please send the bug report to <fuse-sshfs@lists.sourceforge.net>. |
---|
53 | |
---|
54 | Also logs with debugging output can be useful for diagnosing the |
---|
55 | problem. Try running sshfs with the following options: |
---|
56 | sshfs -odebug,sshfs_debug,loglevel=debug ... |
---|
57 | |
---|
58 | Doing strace on the application which fails may also sometimes help: |
---|
59 | strace -f -o /tmp/strace application args ... |
---|
60 | |
---|
61 | Note that large messages (over 40k) will be rejected from the mailing |
---|
62 | list. So try to keep the logs as short as possible. |
---|
63 | |
---|
64 | Why do permissions in nautilus not work! |
---|
65 | |
---|
66 | Unanswered. |
---|
67 | |
---|
68 | Advantage of sshfs over NFS and Samba |
---|
69 | |
---|
70 | Users can mount remote resources they already have ssh access to, |
---|
71 | without requiring the remote machine to export the resource. |
---|
72 | |
---|
73 | The remote resource can be mounted when it is needed in a location |
---|
74 | that is convenient for the user at that time, without needing to rely |
---|
75 | on a central, root-controlled file system table. |
---|
76 | |
---|
77 | Automatic mounting, if desired, can be added to a shell script such as |
---|
78 | .bashrc (provided authentication is done using RSA/DSA keys). |
---|
79 | |
---|
80 | Resources can be mounted over slow and unreliable (distant) |
---|
81 | connections. |
---|
82 | |
---|
83 | Create the device node |
---|
84 | |
---|
85 | If you don't use udev, you may get this error message: |
---|
86 | |
---|
87 | fusermount: failed to open /dev/fuse: No such device or address |
---|
88 | |
---|
89 | Before loading the fuse kernel module, create the device node |
---|
90 | manually: |
---|
91 | |
---|
92 | mknod -m 666 /dev/fuse c 10 229 |
---|
93 | |
---|
94 | mv fails with "Operation not permitted". |
---|
95 | |
---|
96 | Use -o workaround=rename (requires sshfs version >= 1.3). |
---|
97 | |
---|
98 | cvs fails with "cvs status aborted?: cannot get working directory: No such |
---|
99 | file or directory" in a sshfs mounted directory |
---|
100 | |
---|
101 | Use the -oreaddir_ino option. Example: sshfs -oreaddir_ino |
---|
102 | hostname:remote_dir mount_point |
---|
103 | |
---|
104 | Changes on the server are not immediately visible in the mounted directory. |
---|
105 | |
---|
106 | By default, sshfs caches things for 20 seconds, use -o cache_timeout=N |
---|
107 | to change the default cache timeout (in seconds) or -o cache=no for |
---|
108 | disabling the cache. |
---|
109 | |
---|
110 | You can also control cache timeouts for directory listing etc with -o |
---|
111 | cache_stat_timeout=N, -o cache_dir_timout=N, and -o |
---|
112 | cache_link_timout=N. |
---|
113 | |
---|
114 | Configuring the ssh connection |
---|
115 | |
---|
116 | In addition to flags like -C, -p, and -o SSHOPT...=, you may find it |
---|
117 | easier to edit your /.ssh/config file. You can add an entry with any |
---|
118 | customization you want, test it with ssh, and finally use it with |
---|
119 | sshfs. As a bonus, you get a short mnemonic for your configuration. |
---|
120 | |
---|
121 | What are the no_readahead and sshfs_sync options for? |
---|
122 | |
---|
123 | These disable read and write optimizations respectively. They don't |
---|
124 | really make sense unless you're doing something special. |
---|
125 | |
---|
126 | Why does df return strange values on partitions mounted via sshfs? |
---|
127 | |
---|
128 | Because the SFTP protocol doesn't have a statfs operation this is |
---|
129 | currently not possible to display proper usage on remote partition. |
---|
130 | |
---|
131 | How do I specfy the remote mount point (since the example defaults to the |
---|
132 | home directory) |
---|
133 | |
---|
134 | The example shows: |
---|
135 | sshfs hostname: mountpoint |
---|
136 | |
---|
137 | To specify a remote mount point use: |
---|
138 | sshfs hostname:remotemountpoint mountpoint |
---|
139 | |
---|
140 | This might be obvious to others, but I ended up looking up the |
---|
141 | interface to sftp to see if I could learn how to specify the remote |
---|
142 | mount point, then thought about the way that scp specifies the remote |
---|
143 | directory, and it worked. |
---|
144 | |
---|
145 | sshfs hangs after a while |
---|
146 | |
---|
147 | Mounting works fine, I can use the files in Mountpoint as good as any |
---|
148 | other files on my system, but after bit of time, changing nothing on |
---|
149 | the remote files sshfs crashes. This means, I can not cd into the |
---|
150 | Mountpoint (xterm hangs, nautilus hangs... every program trying to |
---|
151 | access the Mountpoint gets stuck, and won't return). |
---|
152 | |
---|
153 | Solution: add |
---|
154 | ServerAliveInterval 15 |
---|
155 | |
---|
156 | in your .ssh/config (or use -o ServerAliveInterval=15 on the sshfs |
---|
157 | command line but I did not test that solution). This will force the |
---|
158 | ssh connection to stay alive even if you have no activity. |
---|
159 | |
---|
160 | Following symlinks on the server side |
---|
161 | |
---|
162 | The -o follow_symlinks option will enable this. |
---|
163 | |
---|
164 | Making absolute symlinks work |
---|
165 | |
---|
166 | Use the -o transform_symlinks option, which will transform absolute |
---|
167 | symlinks (ones which point somewhere inside the mount) into relative |
---|
168 | ones. |
---|
169 | |
---|
170 | Mounting as root |
---|
171 | |
---|
172 | Generally it's not possible to use an sshfs mount as a "real" |
---|
173 | filesystem shared between multiple users. Some of this functionality |
---|
174 | can be enabled with the -o allow_other and -o default_permissions |
---|
175 | options, but files will not be created with the correct ownership, |
---|
176 | etc... |
---|
177 | |
---|
178 | Exporting via NFS |
---|
179 | |
---|
180 | Use the userspace NFS daemon http://sourceforge.net/projects/unfs |
---|
181 | |
---|
182 | Automatical mounting using /etc/fstab |
---|
183 | |
---|
184 | A line in /etc/fstab has the following format: |
---|
185 | sshfs#USERNAME@REMOTE_HOST:REMOTE_PATH MOUNT_POINT fuse SSHFS_OPTIONS 0 0 |
---|
186 | |
---|
187 | e.g. |
---|
188 | sshfs#guest@guest.login.com:data /mnt/guest fuse uid=1003,gid=100,umask=0,allow |
---|
189 | _other 0 0 |
---|
190 | |
---|
191 | Why does SVN (etc...) fail with permission denied? |
---|
192 | |
---|
193 | This is a bug that happens when an application creates a read-only |
---|
194 | file opened for writing (e.g. open("foo", O_WRONLY|O_CREAT, 0444)) |
---|
195 | |
---|
196 | It has been fixed in sshfs version 1.3, but also requires FUSE version |
---|
197 | >=2.5.X and Linux kernel version >=2.6.15. |
---|
198 | |
---|
199 | Why does SVN (etc...) fail to rename files? |
---|
200 | |
---|
201 | $ svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs |
---|
202 | svn: Can't move 'kdelibs/.svn/tmp/entries' to 'kdelibs/.svn/entries': Operation |
---|
203 | not permitted |
---|
204 | |
---|
205 | The reason is that SFTP protocol version 3 (which is implemented by |
---|
206 | OpenSSH's sftp-server) defines the rename operation slightly |
---|
207 | differently than POSIX. The difference is that renaming to an existing |
---|
208 | file or directory will fail instead of atomically replacing the old |
---|
209 | file. |
---|
210 | |
---|
211 | The -o workaround=rename option will try to emulate POSIX rename |
---|
212 | semantics, but it cannot guarantee atomicity. In most of the cases |
---|
213 | this doesn't matter, and things will work fine with this option. |
---|
214 | |
---|
215 | Is there some neat way to do it in reverse? |
---|
216 | |
---|
217 | You want to mount a USB thumb drive onto a file server that is rather |
---|
218 | remote. |
---|
219 | |
---|
220 | Assuming this is difficult because the laptop with the thumb drive is |
---|
221 | sitting behind NAT, firewalls, etc. then you need to create a |
---|
222 | port-forward: |
---|
223 | client$ ssh -R 2222:localhost:22 server |
---|
224 | server$ sshfs -p 2222 localhost:/media/usb1 myusb1 |
---|
225 | |
---|
226 | (Now, is there is there a smarter way that does not involve port |
---|
227 | opening login permissions in an undesireable direction?) |
---|
228 | |
---|
229 | Might it be reasonable to disallow loops? |
---|
230 | |
---|
231 | sshfs localhost:/mnt /mnt |
---|
232 | |
---|
233 | This seems to produce undesirable results. --JoshuaRodman? |
---|
234 | |
---|
235 | How to mount through an intermediary ssh server, eg: localhost -> A -> B; |
---|
236 | mount B from localhost |
---|
237 | |
---|
238 | Start by mounting the folder you need that is on "a" to a folder on |
---|
239 | "b" then mount the new folder that is on "a" to a folder on localhost. |
---|
240 | |
---|
241 | IE: (These are NOT real commands, but a sequence of steps. |
---|
242 | A mounts B:/home/x on /mnt/Bx |
---|
243 | localhost mounts A:/mnt/Bx on ~/mydir |
---|
244 | |
---|
245 | Alternative Solution: |
---|
246 | |
---|
247 | 1) Create a shell script to wrap the tunneling of one ssh command over |
---|
248 | another, |
---|
249 | $ cat >Atunnel <<EOF |
---|
250 | #!/bin/bash |
---|
251 | ssh -q A ssh -q "$@" |
---|
252 | EOF |
---|
253 | $ chmod u+x Atunnel |
---|
254 | |
---|
255 | N.B. make sure to put this somewhere on your path. 2) sshfs mount as |
---|
256 | normal but using this script as the ssh command. |
---|
257 | $ sshfs -o ssh_command='Atunnel' B: ~/mydir |
---|
258 | |
---|
259 | Works beautifully for me. -- JadRef? |
---|
260 | |
---|
261 | I seem to have successfully mounted a remote directory, but performing an |
---|
262 | `ls -l` on the directory above the mount point shows the mount point's |
---|
263 | attributes as `? ? ? ? ? ?`. Nothing shows up in the directory either. What |
---|
264 | am I doing wrong? |
---|
265 | |
---|
266 | You probably specified a remote path with the tilde (~) in it. This |
---|
267 | doesn't seem to work. Instead, specify an absolute remote path: |
---|
268 | sshfs username@remote.host:/home/username/whatever my/mount |
---|
269 | |
---|
270 | What options do i use to make playing media files (music) over sshfs more |
---|
271 | efficient? |
---|
272 | |
---|
273 | MacFUSE doesn't seem to let me move files from one directory to another. It |
---|
274 | first asks for my local user password (i.e. the password on my Macbook Pro) |
---|
275 | and then produces the error message "The operation cannot be completed |
---|
276 | because one or more required items cannot be found. (Error code -120). |
---|
277 | |
---|
278 | How can I get procmail to open, read and write to remote directories over |
---|
279 | sshfs? |
---|