Compare commits

...

58 Commits

Author SHA1 Message Date
Miklos Szeredi 6b4415ada4 Released 2.5 2014-01-14 15:23:31 +01:00
Alexander Neumann 6a2d06e36f Implement asynchronous readdir
Accessing directories with many (several thousand) files over sshfs is
slow, because most SFTP server implementations only send a fixed amount
of entries per READDIR command (e.g. OpenSSH SFTP: 100 entries). This
patch implements sending several READDIR commands in parallel, in order
to speed up directory listing in these cases.

An option (sync_readdir) is also added so that users can easily switch
on the old behaviour.

The performance improvement is astonishing. Accessing a directory with
30k files in from a remote server that has a RTT of 15ms via OpenSSH
SFTP:

Synchronous readdir:
 $ ./sshfs -o sync_readdir host:/tmp /mnt/temp
 $ time "ls" -1 /mnt/temp/test | wc -l
 30000
 "ls" -1 /mnt/temp/test  0.07s user 0.01s system 1% cpu 6.928 total

Asynchronous readdir:
 $ ./sshfs host:/tmp /mnt/temp
 $ time "ls" -1 /mnt/temp/test | wc -l
 30000
 "ls" -1 /mnt/temp/test  0.07s user 0.01s system 12% cpu 0.605 total

Accessing a directory with 100k files shows even more dramatic
improvement:

Synchronous readdir:
 $ ./sshfs -o sync_readdir host:/tmp /mnt/temp
 $ time "ls" -1 /mnt/temp/test2 | wc -l
 100000
 "ls" -1 /mnt/temp/test2  0.67s user 1.22s system 0% cpu 3:31.56 total

Asynchronous readdir:
 $ ./sshfs host:/tmp /mnt/temp
 $ time "ls" -1 /mnt/temp/test2 | wc -l
 100000
 "ls" -1 /mnt/temp/test2  0.20s user 0.03s system 14% cpu 1.631 total

This can easily be reproduced by creating a directory on a server and
touching a lot of files in it:
 $ mkdir /tmp/test
 $ cd /tmp/test
 $ for i in $(seq 1 30000); do touch $i; done

Signed-off-by: Alexander Neumann <alexander@bumpern.de>
2014-01-08 16:34:52 +01:00
Miklos Szeredi 334e9e6a27 Add -o disable_hardlink option (debian bug #670926)
Reported by Louis-David Mitterrand
2014-01-08 12:31:18 +01:00
Miklos Szeredi 91c1f2ba9e Map SSH2_FX_FAILURE to ENOTEMPTY for rmdir
Reported by Ross Lagerwall
2014-01-07 18:52:51 +01:00
Miklos Szeredi c1d62f2032 fix a typo in man page 2013-04-11 17:58:21 +02:00
Alan Jenkins 61524cd1e8 fix missing newline in manual page 2013-02-18 14:36:51 +01:00
Miklos Szeredi 9f4ba56b52 Add FIXME for deadlock if $PATH contains mountpoint.
Reported by Joachim Kopp
2013-02-05 12:33:36 +01:00
Miklos Szeredi ce6753c88f When checking root directory use LSTAT not STAT
This prevents I/O error being returned after a successful mount if a symlink is
mounted.

Reported by Bart Friederichs
2012-05-14 16:18:22 +02:00
Miklos Szeredi 857d634e09 Released 2.4 2012-03-08 10:36:10 +01:00
Mike Kelly 4dc10686e0 make sure idmap files aren't writable by others
otherwise, other local users could change the mapping, and gain access
to things they shouldn't
2012-03-08 10:34:39 +01:00
Chris Wolfe b3af91b123 Add slave option to run sftp over stdin and stdout
Add -o slave. This option routes the sftp communication over stdin and stdout,
bypassing SSH and network.
2012-02-14 12:55:15 +01:00
Chris Wolfe acb0832ffd Split fd into separate read and write pipes 2012-02-14 12:55:14 +01:00
Miklos Szeredi c5949f06fa fix unused but set variables
cache.c: In function ‘cache_add_attr’:
cache.c:167:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_dir’:
cache.c:188:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
cache.c: In function ‘cache_add_link’:
cache.c:212:9: warning: variable ‘now’ set but not used [-Wunused-but-set-variable]
2012-02-08 10:21:33 +01:00
Chris Wolfe b0f3d73028 Remove some trailing whitespace.
Verified with `cat -vet` and `grep '\s$'`
2012-02-08 10:15:52 +01:00
Mike Kelly 75bfa9a6c0 skip blank lines 2011-12-21 10:05:08 +01:00
Mike Kelly e8e26c0bc1 increase portability
getline() isn't widely available yet, use fgets() instead
2011-12-21 10:05:08 +01:00
Mike Kelly cfcae008e3 fix typo in error message 2011-12-21 10:05:08 +01:00
Mike Kelly 7ca565d80d default to erroring if we can't remap a uid/gid
add a '-o nomap=ignore|error' option, which defaults to 'error'
2011-12-21 10:05:08 +01:00
Mike Kelly 301cc5218b Add -o idmap=file, -o uidmap=FILE, -o gidmap=FILE
These options allow you to create a pair of local files, with
username:uid/groupname:gid pairs, one per line. Alternatively, files can
be in standard /etc/passwd / /etc/group format.

The uid/gids are for the remote server, their local counterparts are
looked up with a local getpwnam/getgrnam call. Any stat() calls will
show with the remapped local uid/gid, and any chown() calls will be
remapped back to the remote uid/gid.
2011-12-20 15:33:58 +01:00
Mike Kelly d666318c7a Fix a possible small memory leak 2011-12-20 15:33:58 +01:00
Mike Kelly ea0d68651e Fix typo in error message
s/FD_CLOESEC/FD_CLOEXEC/
2011-12-20 15:33:58 +01:00
Miklos Szeredi 2f6665d84e Fix error handling in sshfs_read_end
Reported by Mike Kelly
2011-12-20 14:55:45 +01:00
Miklos Szeredi 2ce4069832 Make chown respect the UID mapping policy
Reported and tested by Vivenzio Pagliari
2011-12-05 13:11:09 +01:00
Miklos Szeredi 97228b866a Submit max 32k reads and writes to the sftp server
Also don't limit the kernel to 64k reads and writes, rather split into
32k sized chunks and send them to the server all at once.  This is
more efficient and less demanding from the server.

Reported by Ludovic Courtès.  Fix suggested by Niels Möller
2011-11-16 14:54:37 +01:00
Miklos Szeredi f3286cdf86 Add locking around modifver and connver 2011-11-14 16:28:13 +01:00
Miklos Szeredi 955751ad36 Fix double free if reconnection races with request sending
Patch by E. Kuemmerle
2011-11-14 15:12:52 +01:00
Miklos Szeredi b5f0c128f5 Remove "-oPreferredAuthentications" from ssh options
Remove "-oPreferredAuthentications" from ssh options if the
"password_stdin" option is used.  Reported by E. Kuemmerle
2011-10-21 17:12:31 +02:00
Miklos Szeredi 77d57a4a5d Add "FIXME: really needs LSETSTAT extension (debian Bug#640038)" 2011-09-23 14:33:32 +02:00
Percy Jahn 19cb995c23 sshfs: fstat workaround
Add "-oworkaround=fstat" for SFTP servers which don't support
the FSTAT message.
2011-08-24 13:22:36 +02:00
Miklos Szeredi 49203ee923 Released 2.3 2011-07-01 14:24:49 +02:00
Miklos Szeredi 6c1968e9e5 Update COPYING 2011-07-01 14:15:39 +02:00
Miklos Szeredi a575d48234 Add hard link operation
Works if the server supports the "hardlink@openssh.com" protocol
extension.
2011-07-01 14:01:29 +02:00
Miklos Szeredi eac5268e87 Fix possible deadlock on reconnection
Reported by Florian Zumbiehl
2011-03-25 13:38:39 +01:00
Miklos Szeredi 6d5e12e1b6 Fix cleanup when ssh connection is terminated.
This prevents sshfs hanging when the server is rebooted, for example.
2011-01-25 11:46:15 +01:00
Miklos Szeredi b1b0c4b6f5 * Set FD_CLOEXEC on fuse device. This prevents deadlocks that
happen in some circumstances (bugzilla.kernel.org #12864).
2010-04-28 08:59:12 +00:00
Miklos Szeredi f018ac3b1c * Check that the remote path specified refers to the same type of
file as the mountpoint, i.e. both are directories or both are
non-directories (debian bug #535343).  Reported by Greg Kochanski

* Allow mounting a single non-directory from the server
2009-07-15 15:57:04 +00:00
Miklos Szeredi 2431a280eb tear down mount on connect failure 2009-07-15 15:08:55 +00:00
Miklos Szeredi 0eabd86300 Check mountpoint and fuse options before starting an ssh
session (debian bug #535333).  This is only supported if compiled
against libfuse-2.6 or later. Reported by Greg Kochanski
2009-07-15 14:27:52 +00:00
Miklos Szeredi ae4614e690 Add option 'delay_connect': This will always create the sshfs mount,
even if the connection to the server can't be established.
2009-07-15 14:20:58 +00:00
Miklos Szeredi b1fa0408fb * Print usage information and version to stdout, not stderr.
Libfuse also needs to be fixed up.  Reported by Kārlis Repsons
2009-02-12 07:11:33 +00:00
Miklos Szeredi 09e37d536f Released 2.2 2008-10-20 12:15:07 +00:00
Miklos Szeredi be44229cfe Escape commas in fsname option if libfuse supports it 2008-10-20 12:03:16 +00:00
Miklos Szeredi c7dbdc1f77 Fix harmless glib assertations with "cache=no" 2008-10-08 18:23:33 +00:00
Miklos Szeredi 8a4015a3b6 * Handle numerical IPv6 addresses enclosed in square brackets. Reported by Andre-John Mas * Fix error if username contains a comma character. Reported by Yang Zhang 2008-10-08 11:07:48 +00:00
Miklos Szeredi fd52ef3e51 Released 2.1 2008-07-11 10:59:12 +00:00
Miklos Szeredi 1abdbe64a3 Add '-F' option to specify the ssh config file 2008-06-24 15:24:01 +00:00
Miklos Szeredi 4b28b15c34 Fix bug in caching which could cause file corruption for append mode writes 2008-05-06 15:10:28 +00:00
Miklos Szeredi 1a76a16bd9 man page update from Bartosz 2008-04-25 06:39:37 +00:00
Miklos Szeredi b1748d87aa Add manual page 2008-04-23 12:12:25 +00:00
Miklos Szeredi ff1a5c7a71 Add manual page 2008-04-23 12:07:39 +00:00
Miklos Szeredi 09579af980 Released 2.0 2008-04-22 16:01:59 +00:00
Miklos Szeredi eeea0ff5a6 Support "statvfs@openssh.com" extension... 2008-04-22 14:25:19 +00:00
Miklos Szeredi 4b88fc4731 Limit write requests to 64kB 2008-04-22 13:36:26 +00:00
Miklos Szeredi b246ad3da0 Allow the '-ossh_command=CMD' command to contain parameters... 2008-04-22 13:00:14 +00:00
Miklos Szeredi c61e700aab Fix incorrect disk usage reported by 'du' for files of size 4GB or above 2008-04-22 10:20:05 +00:00
Miklos Szeredi 4d6e5a03da Support "posix-rename@openssh.com" extension... 2008-03-31 11:30:43 +00:00
Miklos Szeredi 4802b14791 Add support for password authentication with pam_mount. 2008-03-28 19:22:19 +00:00
Miklos Szeredi 03381402b2 *** empty log message *** 2008-03-27 16:18:09 +00:00
11 changed files with 2466 additions and 265 deletions
-17
View File
@@ -1,17 +0,0 @@
.deps
COPYING
INSTALL
FAQ.txt
Makefile
Makefile.in
aclocal.m4
*.cache
config.*
configure
compile
depcomp
install-sh
missing
sshfs
stamp*
.deps
+36
View File
@@ -0,0 +1,36 @@
#
# NOTE! Don't add files that are generated in specific
# subdirectories here. Add them in the ".gitignore" file
# in that subdirectory instead.
#
# NOTE! Please use 'git ls-files -i --exclude-standard'
# command after changing this file, to see if there are
# any tracked files which get ignored after the change.
.*
!.gitignore
*.o
*.lo
*.la
*.gz
\#*#
*.orig
*~
Makefile.in
Makefile
*.m4
stamp-h*
config.*
/sshfs
/ltmain.sh
/configure
/install-sh
/mkinstalldirs
/missing
/*.cache
/depcomp
/compile
/libtool
/INSTALL
/.pc
/patches
/m4
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+223
View File
@@ -1,3 +1,226 @@
2014-01-14 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.5
2014-01-08 Miklos Szeredi <miklos@szeredi.hu>
* Add -o disable_hardlink option (debian bug #670926). Reported
by Louis-David Mitterrand
* Optimize readdir by sending multiple requests in parallel. Add
-o sync_readdir to restore old behavior. Patch by Alexander
Neumann
2014-01-07 Miklos Szeredi <miklos@szeredi.hu>
* Map SSH2_FX_FAILURE to ENOTEMPTY for rmdir. Reported by Ross
Lagerwall
2012-05-14 Miklos Szeredi <miklos@szeredi.hu>
* When checking root directory use LSTAT not STAT. This prevents
I/O error being returned after a successful mount if a symlink is
mounted. Reported by Bart Friederichs
2012-03-08 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.4
2012-03-08 Miklos Szeredi <miklos@szeredi.hu>
* Make sure idmap files aren't writable by others otherwise, other
local users could change the mapping, and gain access to things
they shouldn't. Patch by Mike Kelly
2012-02-08 Chris Wolfe <cwolfe@chromium.org>
* Add -o slave. This option routes the sftp communication over stdin
and stdout, bypassing SSH and network.
2011-12-16 Mike Kelly <mike@pair.com>
* Add -o idmap=file, -o uidmap=FILE, -o gidmap=FILE. These options
allow you to create a pair of local files, similar to /etc/passwd or
/etc/group files from the remote server, and use those to remap all
the given UIDs/GIDs.
2011-11-25 Miklos Szeredi <miklos@szeredi.hu>
* Make chown respect the UID mapping policy. Reported and tested
by Vivenzio Pagliari
2011-11-16 Miklos Szeredi <miklos@szeredi.hu>
* Submit max 32k reads and writes to the sftp server. Also don't
limit the kernel to 64k reads and writes, rather split into 32k
sized chunks and send them to the server all at once. This is
more efficient and less demanding from the server. Reported by
Ludovic Courtès. Fix suggested by Niels Möller
2011-11-14 Miklos Szeredi <miklos@szeredi.hu>
* Fix double free if reconnection races with request sending.
Patch by E. Kuemmerle
* Add locking around modifver and connver
2011-10-21 Miklos Szeredi <miklos@szeredi.hu>
* Remove "-oPreferredAuthentications" from ssh options if the
"password_stdin" option is used. Reported by E. Kuemmerle
2011-08-24 Miklos Szeredi <miklos@szeredi.hu>
* Add "-oworkaround=fstat" for SFTP servers which don't support
the FSTAT message. Patch by: Percy Jahn
2011-07-01 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.3
2011-07-01 Miklos Szeredi <miklos@szeredi.hu>
* Add hard link operation. Works if the server supports the
"hardlink@openssh.com" protocol extension.
2011-03-25 Miklos Szeredi <miklos@szeredi.hu>
* Fix possible deadlock on reconnection. Reported by Florian
Zumbiehl
2011-01-25 Miklos Szeredi <miklos@szeredi.hu>
* Fix cleanup when ssh connection is terminated. This prevents
sshfs hanging when the server is rebooted, for example.
2010-03-16 Miklos Szeredi <miklos@szeredi.hu>
* Set FD_CLOEXEC on fuse device. This prevents deadlocks that
happen in some circumstances (bugzilla.kernel.org #12864).
Reported by Tim Connors
2009-07-15 Miklos Szeredi <miklos@szeredi.hu>
* Check mountpoint and fuse options before starting an ssh
session (debian bug #535333). This is only supported if compiled
against libfuse-2.6 or later. Reported by Greg Kochanski
* Check that the remote path specified refers to the same type of
file as the mountpoint, i.e. both are directories or both are
non-directories (debian bug #535343). Reported by Greg Kochanski
* Allow mounting a single non-directory from the server
2009-07-15 Sebastian Dransfeld <sebastid@tango.flipp.net>
* Add option 'delay_connect': This will always create the sshfs mount,
even if the connection to the server can't be established.
2009-01-27 Miklos Szeredi <miklos@szeredi.hu>
* Print usage information and version to stdout, not stderr.
Libfuse also needs to be fixed up. Reported by Kārlis Repsons
2008-10-20 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.2
2008-10-20 Miklos Szeredi <miklos@szeredi.hu>
* Escape commas in fsname option if libfuse supports it
2008-10-08 Miklos Szeredi <miklos@szeredi.hu>
* Handle numerical IPv6 addresses enclosed in square brackets.
Reported by Andre-John Mas
* Fix error if username contains a comma character. Reported by
Yang Zhang
* Fix harmless glib assertations with "cache=no"
2008-07-11 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.1
2008-07-11 Miklos Szeredi <miklos@szeredi.hu>
* Fix statvfs extension to match the current protocol in
opensshfs
* Check version numbers of extensions, so such changes wouldn't
cause stupid behavior
2008-06-24 Miklos Szeredi <miklos@szeredi.hu>
* Add '-F' option to specify the ssh config file. Patch by Pat
Pascal.
2008-05-06 Miklos Szeredi <miklos@szeredi.hu>
* Fix bug in caching which could cause file corruption for append
mode writes. Reported by Jose Alonso
2008-05-05 Miklos Szeredi <miklos@szeredi.hu>
* Fix compile on OS X. Original patch from Michael G Schwern
* Fix compile on Solaris. Reported by Jean-Jacques Sarton
2008-04-23 Miklos Szeredi <miklos@szeredi.hu>
* Released 2.0
2008-04-23 Miklos Szeredi <miklos@szeredi.hu>
* Add manual page. Written by Bartosz Fenski
2008-04-22 Miklos Szeredi <miklos@szeredi.hu>
* Add missing ssh options: ControlMaster, ControlPath,
KbdInteractiveAuthentication, KbdInteractiveDevices, LocalCommand,
RekeyLimit (Debian bug #430225).
* Allow the '-ossh_command=CMD' command to contain parameters.
Escape charater is backslash.
* Limit write requests to 64kB.
* Support "statvfs@openssh.com" extension, which will be available
in OpenSSH 5.1.
2008-04-21 Miklos Szeredi <miklos@szeredi.hu>
* Fix incorrect disk usage reported by 'du' for files of size 4GB
or above. Reported by Christian Boltz.
2008-04-16 Miklos Szeredi <miklos@szeredi.hu>
* If debugging is enabled, print some statistics at exit about the
number of bytes transferred, etc..
2008-03-31 Miklos Szeredi <miklos@szeredi.hu>
* Support "posix-rename@openssh.com" extension available in
OpenSSH 4.9. This allows rename to be atomic even when target
file or directory exists. If available, the extension will be
used instead of the rename operation in the original protocol and
the "-oworkaround=rename" option will be ignored.
2008-03-28 Miklos Szeredi <miklos@szeredi.hu>
* Add support for password authentication with pam_mount.
Original patch and help with testing: John S. Skogtvedt
2008-03-03 Miklos Szeredi <miklos@szeredi.hu>
* Fix ssh debug only appearing if "-d" is used. Reported by
Michael Gorbach
2008-01-03 Miklos Szeredi <miklos@szeredi.hu>
* Fix condition for building of sshnodelay.so
2007-12-17 Miklos Szeredi <miklos@szeredi.hu>
* Released 1.9
+2
View File
@@ -14,6 +14,8 @@ sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\"
EXTRA_DIST = sshnodelay.c FAQ.txt
CLEANFILES = sshnodelay.so
dist_man_MANS = sshfs.1
if SSH_NODELAY_SO
all-local: sshnodelay.so
+23
View File
@@ -1,3 +1,26 @@
What is new in 2.1, 2.2 and 2.3
-------------------------------
* Support hard link creation if server is OpenSSH 5.7 or later
* Check mount point and options before connecting to ssh server
* Handle commas in usernames
* Small improvements and bug fixes
What is new in 2.0
------------------
* Support password authentication with pam_mount
* Support atomic renames if server is OpenSSH 4.9 or later
* Support getting disk usage if server is OpenSSH 5.1 or later
* Small enhancements and bug fixes
What is new in 1.9
------------------
+43 -17
View File
@@ -28,6 +28,7 @@ struct cache {
GHashTable *table;
pthread_mutex_t lock;
time_t last_cleaned;
uint64_t write_ctr;
};
static struct cache cache;
@@ -47,6 +48,7 @@ struct fuse_cache_dirhandle {
fuse_dirh_t h;
fuse_dirfil_t filler;
GPtrArray *dir;
uint64_t wrctr;
};
static void free_node(gpointer node_)
@@ -103,11 +105,22 @@ static void cache_purge_parent(const char *path)
void cache_invalidate(const char *path)
{
if (!cache.on)
return;
pthread_mutex_lock(&cache.lock);
cache_purge(path);
pthread_mutex_unlock(&cache.lock);
}
void cache_invalidate_write(const char *path)
{
pthread_mutex_lock(&cache.lock);
cache_purge(path);
cache.write_ctr++;
pthread_mutex_unlock(&cache.lock);
}
static void cache_invalidate_dir(const char *path)
{
pthread_mutex_lock(&cache.lock);
@@ -148,30 +161,31 @@ static struct node *cache_get(const char *path)
return node;
}
void cache_add_attr(const char *path, const struct stat *stbuf)
void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
{
struct node *node;
time_t now;
if (!cache.on)
return;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
node->stat = *stbuf;
node->stat_valid = time(NULL) + cache.stat_timeout;
if (node->stat_valid > node->valid)
node->valid = node->stat_valid;
cache_clean();
if (wrctr == cache.write_ctr) {
node = cache_get(path);
node->stat = *stbuf;
node->stat_valid = time(NULL) + cache.stat_timeout;
if (node->stat_valid > node->valid)
node->valid = node->stat_valid;
cache_clean();
}
pthread_mutex_unlock(&cache.lock);
}
static void cache_add_dir(const char *path, char **dir)
{
struct node *node;
time_t now;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
g_strfreev(node->dir);
node->dir = dir;
node->dir_valid = time(NULL) + cache.dir_timeout;
@@ -191,11 +205,9 @@ static size_t my_strnlen(const char *s, size_t maxsize)
static void cache_add_link(const char *path, const char *link, size_t size)
{
struct node *node;
time_t now;
pthread_mutex_lock(&cache.lock);
node = cache_get(path);
now = time(NULL);
g_free(node->link);
node->link = g_strndup(link, my_strnlen(link, size-1));
node->link_valid = time(NULL) + cache.link_timeout;
@@ -222,13 +234,25 @@ static int cache_get_attr(const char *path, struct stat *stbuf)
return err;
}
uint64_t cache_get_write_ctr(void)
{
uint64_t res;
pthread_mutex_lock(&cache.lock);
res = cache.write_ctr;
pthread_mutex_unlock(&cache.lock);
return res;
}
static int cache_getattr(const char *path, struct stat *stbuf)
{
int err = cache_get_attr(path, stbuf);
if (err) {
uint64_t wrctr = cache_get_write_ctr();
err = cache.next_oper->oper.getattr(path, stbuf);
if (!err)
cache_add_attr(path, stbuf);
cache_add_attr(path, stbuf, wrctr);
}
return err;
}
@@ -268,7 +292,7 @@ static int cache_dirfill(fuse_cache_dirh_t ch, const char *name,
const char *basepath = !ch->path[1] ? "" : ch->path;
fullpath = g_strdup_printf("%s/%s", basepath, name);
cache_add_attr(fullpath, stbuf);
cache_add_attr(fullpath, stbuf, ch->wrctr);
g_free(fullpath);
}
}
@@ -299,6 +323,7 @@ static int cache_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
ch.h = h;
ch.filler = filler;
ch.dir = g_ptr_array_new();
ch.wrctr = cache_get_write_ctr();
err = cache.next_oper->cache_getdir(path, &ch, cache_dirfill);
g_ptr_array_add(ch.dir, NULL);
dir = (char **) ch.dir->pdata;
@@ -421,7 +446,7 @@ static int cache_write(const char *path, const char *buf, size_t size,
{
int res = cache.next_oper->oper.write(path, buf, size, offset, fi);
if (res >= 0)
cache_invalidate(path);
cache_invalidate_write(path);
return res;
}
@@ -449,9 +474,10 @@ static int cache_fgetattr(const char *path, struct stat *stbuf,
{
int err = cache_get_attr(path, stbuf);
if (err) {
uint64_t wrctr = cache_get_write_ctr();
err = cache.next_oper->oper.fgetattr(path, stbuf, fi);
if (!err)
cache_add_attr(path, stbuf);
cache_add_attr(path, stbuf, wrctr);
}
return err;
}
+2 -1
View File
@@ -24,5 +24,6 @@ struct fuse_cache_operations {
struct fuse_operations *cache_init(struct fuse_cache_operations *oper);
int cache_parse_options(struct fuse_args *args);
void cache_add_attr(const char *path, const struct stat *stbuf);
void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr);
void cache_invalidate(const char *path);
uint64_t cache_get_write_ctr(void);
+4 -4
View File
@@ -1,4 +1,4 @@
AC_INIT(sshfs-fuse, 1.9)
AC_INIT(sshfs-fuse, 2.5)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
@@ -30,14 +30,14 @@ if test -z "$enable_sshnodelay"; then
fi
fi
if test "$enable_sshnodelay" != "no"; then
if test "$enable_sshnodelay" = "yes"; then
AC_DEFINE(SSH_NODELAY_WORKAROUND, 1, [Compile ssh NODELAY workaround])
fi
AM_CONDITIONAL(SSH_NODELAY_SO, test "$enable_sshnodelay" != "no")
AM_CONDITIONAL(SSH_NODELAY_SO, test "$enable_sshnodelay" = "yes")
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
PKG_CHECK_MODULES(SSHFS, [fuse >= 2.2 glib-2.0 gthread-2.0])
PKG_CHECK_MODULES(SSHFS, [fuse >= 2.3 glib-2.0 gthread-2.0])
have_fuse_opt_parse=no
oldlibs="$LIBS"
LIBS="$LIBS $SSHFS_LIBS"
+286
View File
@@ -0,0 +1,286 @@
.TH SSHFS "1" "April 2008" "SSHFS version 2.0" "User Commands"
.SH NAME
SSHFS \- filesystem client based on ssh
.SH SYNOPSIS
.SS mounting
.TP
\fBsshfs\fP [\fIuser\fP@]\fBhost\fP:[\fIdir\fP] \fBmountpoint\fP [\fIoptions\fP]
.SS unmounting
.TP
\fBfusermount -u mountpoint\fP
.SH DESCRIPTION
SSHFS (Secure SHell FileSystem) is a file system for Linux (and other
operating systems with a FUSE implementation, such as Mac OS X or FreeBSD)
capable of operating on files on a remote computer using just a secure
shell login on the remote computer. On the local computer where the SSHFS
is mounted, the implementation makes use of the FUSE (Filesystem in
Userspace) kernel module. The practical effect of this is that the end user
can seamlessly interact with remote files being securely served over SSH
just as if they were local files on his/her computer. On the remote
computer the SFTP subsystem of SSH is used.
.PP
If \fIhost\fP is a numeric IPv6 address, it needs to be enclosed in
square brackets.
.SH OPTIONS
.SS "general options:"
.TP
\fB\-o\fR opt,[opt...]
mount options
.TP
\fB\-h\fR \fB\-\-help\fR
print help
.TP
\fB\-V\fR \fB\-\-version\fR
print version
.SS "SSHFS options:"
.TP
\fB\-p\fR PORT
equivalent to '\-o port=PORT'
.TP
\fB\-C\fR
equivalent to '\-o compression=yes'
.TP
\fB\-F\fR ssh_configfile
specifies alternative ssh configuration file
.TP
\fB\-1\fR
equivalent to '\-o ssh_protocol=1'
.TP
\fB\-o\fR reconnect
reconnect to server
.TP
\fB\-o\fR delay_connect
delay connection to server
.TP
\fB\-o\fR sshfs_sync
synchronous writes
.TP
\fB\-o\fR no_readahead
synchronous reads (no speculative readahead)
.TP
\fB\-o\fR sync_readdir
synchronous readdir
.TP
\fB\-o\fR sshfs_debug
print some debugging information
.TP
\fB\-o\fR cache=BOOL
enable caching {yes,no} (default: yes)
.TP
\fB\-o\fR cache_timeout=N
sets timeout for caches in seconds (default: 20)
.TP
\fB\-o\fR cache_X_timeout=N
sets timeout for {stat,dir,link} cache
.TP
\fB\-o\fR workaround=LIST
colon separated list of workarounds
.RS 8
.TP
none
no workarounds enabled
.TP
all
all workarounds enabled
.TP
[no]rename
fix renaming to existing file (default: off)
.TP
[no]nodelaysrv
set nodelay tcp flag in ssh (default: off)
.TP
[no]truncate
fix truncate for old servers (default: off)
.TP
[no]buflimit
fix buffer fillup bug in server (default: on)
.RE
.TP
\fB\-o\fR idmap=TYPE
user/group ID mapping, possible types are:
.RS 8
.TP
none
no translation of the ID space (default)
.TP
user
only translate UID of connecting user
.TP
file
translate UIDs/GIDs based upon the contents of \fBuidfile \fR and
\fBgidfile\fR
.RE
.TP
\fB\-o\fR uidfile=FILE
file containing username:uid mappings for \fBidmap=file\fR
.RE
.TP
\fB\-o\fR gidfile=FILE
file containing groupname:gid mappings for \fBidmap=file\fR
.RE
.TP
\fB\-o\fR nomap=TYPE
with idmap=file, how to handle missing mappings
.RS 8
.TP
ignore
don't do any re-mapping
.TP
error
return an error (default)
.RE
.TP
\fB\-o\fR ssh_command=CMD
execute CMD instead of 'ssh'
.TP
\fB\-o\fR ssh_protocol=N
ssh protocol to use (default: 2)
.TP
\fB\-o\fR sftp_server=SERV
path to sftp server or subsystem (default: sftp)
.TP
\fB\-o\fR directport=PORT
directly connect to PORT bypassing ssh
.TP
\fB\-o\fR slave
communicate over stdin and stdout bypassing network
.TP
\fB\-o\fR disable_hardlink
link(2) will return with errno set to ENOSYS. Hard links don't currently work
perfectly on sshfs, and this confuses some programs. If that happens try
disabling hard links with this option.
.TP
\fB\-o\fR transform_symlinks
transform absolute symlinks to relative
.TP
\fB\-o\fR follow_symlinks
follow symlinks on the server
.TP
\fB\-o\fR no_check_root
don't check for existence of 'dir' on server
.TP
\fB\-o\fR password_stdin
read password from stdin (only for pam_mount!)
.TP
\fB\-o\fR SSHOPT=VAL
ssh options (see man ssh_config)
.SS "FUSE options:"
.TP
\fB\-d\fR \fB\-o\fR debug
enable debug output (implies \fB\-f\fR)
.TP
\fB\-f\fR
foreground operation
.TP
\fB\-s\fR
disable multi\-threaded operation
.TP
\fB\-o\fR allow_other
allow access to other users
.TP
\fB\-o\fR allow_root
allow access to root
.TP
\fB\-o\fR nonempty
allow mounts over non\-empty file/dir
.HP
\fB\-o\fR default_permissions
enable permission checking by kernel
.TP
\fB\-o\fR fsname=NAME
set filesystem name
.TP
\fB\-o\fR subtype=NAME
set filesystem type
.TP
\fB\-o\fR large_read
issue large read requests (2.4 only)
.TP
\fB\-o\fR max_read=N
set maximum size of read requests
.TP
\fB\-o\fR hard_remove
immediate removal (don't hide files)
.TP
\fB\-o\fR use_ino
let filesystem set inode numbers
.TP
\fB\-o\fR readdir_ino
try to fill in d_ino in readdir
.TP
\fB\-o\fR direct_io
use direct I/O
.TP
\fB\-o\fR kernel_cache
cache files in kernel
.TP
\fB\-o\fR [no]auto_cache
enable caching based on modification times
.TP
\fB\-o\fR umask=M
set file permissions (octal)
.TP
\fB\-o\fR uid=N
set file owner
.TP
\fB\-o\fR gid=N
set file group
.TP
\fB\-o\fR entry_timeout=T
cache timeout for names (1.0s)
.TP
\fB\-o\fR negative_timeout=T
cache timeout for deleted names (0.0s)
.TP
\fB\-o\fR attr_timeout=T
cache timeout for attributes (1.0s)
.TP
\fB\-o\fR ac_attr_timeout=T
auto cache timeout for attributes (attr_timeout)
.TP
\fB\-o\fR intr
allow requests to be interrupted
.TP
\fB\-o\fR intr_signal=NUM
signal to send on interrupt (10)
.TP
\fB\-o\fR modules=M1[:M2...]
names of modules to push onto filesystem stack
.TP
\fB\-o\fR max_write=N
set maximum size of write requests
.TP
\fB\-o\fR max_readahead=N
set maximum readahead
.TP
\fB\-o\fR async_read
perform reads asynchronously (default)
.TP
\fB\-o\fR sync_read
perform reads synchronously
.SS "Module options:"
.TP
[subdir]
.TP
\fB\-o\fR subdir=DIR
prepend this directory to all paths (mandatory)
.TP
\fB\-o\fR [no]rellinks
transform absolute symlinks to relative
.TP
[iconv]
.TP
\fB\-o\fR from_code=CHARSET
original encoding of file names (default: UTF-8)
.TP
\fB\-o\fR to_code=CHARSET
new encoding of the file names (default: ISO-8859-2)
.PD
.SH "AUTHORS"
.LP
SSHFS has been written by Miklos Szeredi <miklos@szeredi.hu>.
.LP
This man page was written by Bartosz Fenski <fenio@debian.org> for the
Debian GNU/Linux distribution (but it may be used by others).
+1508 -226
View File
File diff suppressed because it is too large Load Diff