Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / runtime / kioslave / fish / README
blob43d365cedcb5038e3ce6f6df2bbf0d2624c8ac1b
1 Overview of kio_fish
2 ====================
4   FISH is a protocol to get filesystem access without special server
5   software, only using a remote shell. (Hence the name: FIles transferred
6   over SHell protocol).
7   It was first devised by Pavel Machek <pavel@bug.ucw.cz> and implemented
8   as a Midnight Commander vfs module in 1998.
10   This is a complete client implementation using his original version
11   0.0.2 protocol, extending it with 2 commands (which are only optional -
12   should a real FISH server exist on server side that doesn't understand
13   them, this ioslave still works, only slower). Moreover, this client does
14   complete shell metacharacter quoting on all arguments, a fact that is
15   neccessary but missing from the specs.
16   Extensions used are: append (APPEND command), copy (COPY command),
17   lscount (LIST first prints number of files to be listed), lslinks (LIST
18   shows symlink info instead of info about link targets), lsmime (LIST
19   determines the MIME type on the server side)
20   Password and host key queries are handled via dialog boxes.
21   The goal of this client is to make a remote directory look and feel exactly
22   like a local directory, with all comfort, only slower.
24   NOTE: From version 1.1.3 on, compression is no longer turned on auto-
25   matically. You have to specify it via ~/.ssh/config or wherever
26   your local ssh client reads its settings. The same goes for all other
27   connection parameters. OpenSSH for example has a powerful configuration
28   file syntax which lets you configure access differently for each host,
29   something I do not intend to duplicate. Read the ssh_config(5) man page
30   for details. If someone knows the docs to read for commercial ssh please
31   tell me so I can include that here as well.
33   Included below is the original posting from the mc mailing list archives.
34   
35   If perl is installed on the remote machine and in the default PATH, it will
36   be used to transfer a custom server script which is much faster than
37   shell-only mode and more predictable as well. The script is stored in a
38   file called .fishsrv.pl in the working directory directly after login and
39   will be reused on subsequent connections.
41   2001/10/07 Jörg Walter <trouble@garni.ch>
45 From: Pavel Machek <pavel@bug.ucw.cz>
46 Subject: New virtual filesystem - fish
47 Date: Tue, 15 Sep 1998 22:30:07 +0200
49 Hi!
51 New virtual filesystem has been created, which allows you to access
52 files on remote computer over rsh/ssh connection, with _no_ server
53 needed on the other side. To use it from mc or any program using
54 libvfs.so, do
56 cd /#sh:user@host.to.connect.to/
58 Note that password authentication will not work, so you must be
59 authenticated using [rs]hosts or RSA key.
61 For protocol, see mc/vfs/README.fish. If someone wants to write
62 server, it would be good idea, since it works without server but
63 performance is not optimal.
65                                                         Pavel
67 PS: Protocol looks like this. If you have any comments, it is time to
68 speak.
71                 FIles transferred over SHell protocol (V 0.0.2)
72                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 This protocol was designed for transferring files over secureshell
75 (ssh) connection. It can be as well used for transfers over rsh, and
76 there may be other uses.
78 Client sends requests of following form:
80 #FISH_COMMAND
81 equivalent shell commands,
82 which may be multiline
84 Only fish commands are defined here, shell equivalents are for your
85 information only and will probably vary from implementation to
86 implementation. Fish commands always have priority: server is
87 expected to execute fish command if it understands it. If it does not,
88 however, it can try the luck and execute shell command.
90 Server's reply is multiline, but alwyas ends with
92 ### 000<optional text>
94 line. ### is prefix to mark this line, 000 is return code. Return
95 codes are superset to those used in ftp.
97 There are few new exit codes defined:
99 000 don't know; if there were no previous lines, this marks COMPLETE
100 success, if they were, it marks failure.
102 001 don't know; if there were no previous lines, this marks
103 PRELIMinary success, if they were, it marks failure
105                                 Connecting
106                                 ~~~~~~~~~~
107 Client uses "echo FISH:;/bin/sh" as command executed on remote
108 machine. This should make it possible for server to distinguish FISH
109 connections from normal rsh/ssh.
111                                 Commands
112                                 ~~~~~~~~
113 #FISH
114 echo; start_fish_server; echo '### 200'
116 This command is sent at the begining. It marks that client wishes to
117 talk via FISH protocol. #VER command must follow. If server
118 understands FISH protocol, it has option to put FISH server somewhere
119 on system path and name it start_fish_server.
121 #VER 0.0.2 <feature1> <feature2> <...>
122 echo '### 000'
124 This command is the second one. It sends client version and extensions
125 to the server. Server should reply with protocol version to be used,
126 and list of extensions accepted.
128 VER 0.0.0 <feature2>
129 ### 200
131 #PWD
132 pwd; echo '### 200'
134 Server should reply with current directory (in form /abc/def/ghi)
135 followed by line indicating success.
137 #LIST /directory
138 ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
140 d$m $d $y
142 "; done )
143 ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g
144 E$a$i
145 dD$m $d $y
147 "; done )
148 echo '### 200'
150 This allows client to list directory or get status information about
151 single file. Output is in following form (any line except :<filename>
152 may be ommited):
154 P<unix permissions> <owner>.<group>
155 S<size>
156 d<3-letters month name> <day> <year or HH:MM>
157 D<year> <month> <day> <hour> <minute> <second>[.1234]
158 E<major-of-device>,<minor>
159 :<filename>
160 L<filename symlink points to>
161 <blank line to separate items>
163 Unix permissions are of form X--------- where X is type of
164 file. Currently, '-' means regular file, 'd' means directory, 'c', 'b'
165 means character and block device, 'l' means symbolic link, 'p' means
166 FIFO and 's' means socket.
168 'd' has three fields: month (one of strings Jan Feb Mar Apr May Jun
169 Jul Aug Sep Oct Nov Dec), day of month, and third is either single
170 number indicating year, or HH:MM field (assume current year in such
171 case). As you've probably noticed, this is pretty broken; it is for
172 compatibility with ls listing.
174 #RETR /some/name
175 ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200'
177 Server sends line with filesize on it, followed by line with ### 100
178 indicating partial success, then it sends binary data (exactly
179 filesize bytes) and follows them with (with no preceeding newline) ###
180 200.
182 Note that there's no way to abort running RETR command - except
183 closing the connection.
185 #STOR <size> /file/name
186 <i><font color="#008000">> /file/name; echo '### 001'; ( dd bs=4096 count=<size/4096>; dd bs=<size%4096> count=1 ) 2>/dev/null | ( cat > %s; cat > /dev/null ); echo '### 200'
187 </font></i>
188 This command is for storing /file/name, which is exactly size bytes
189 big. You probably think I went crazy. Well, I did not: that strange
190 cat > /dev/null has purpose to discard any extra data which was not
191 written to disk (due to for example out of space condition).
193 [Why? Imagine uploading file with "rm -rf /" line in it.]
195 #CWD /somewhere
196 cd /somewhere; echo '### 000'
198 It is specified here, but I'm not sure how wise idea is to use this
199 one: it breaks stateless-ness of the protocol.
201 Following commands should be rather self-explanatory:
203 #CHMOD 1234 file
204 chmod 1234 file; echo '### 000'
206 #DELE /some/path
207 rm -f /some/path; echo '### 000'
209 #MKD /some/path
210 mkdir /some/path; echo '### 000'
212 #RMD /some/path
213 rmdir /some/path; echo '### 000'
215 #RENAME /path/a /path/b
216 mv /path/a /path/b; echo '### 000'
218 #LINK /path/a /path/b
219 ln /path/a /path/b; echo '### 000'
221 #SYMLINK /path/a /path/b
222 ln -s /path/a /path/b; echo '### 000'
224 #CHOWN user /file/name
225 chown user /file/name; echo '### 000'
227 #CHGRP group /file/name
228 chgrp group /file/name; echo '### 000'
230 #READ <offset> <size> /path/and/filename
231 cat /path/and/filename | ( dd bs=4096 count=<offset/4096> > /dev/null;
232 dd bs=<offset%4096> count=1 > /dev/null;
233 dd bs=4096 count=<offset/4096>;
234 dd bs=<offset%4096> count=1; )
236 Returns ### 200 on successfull exit, ### 291 on successfull exit when
237 reading ended at eof, ### 292 on successfull exit when reading did not
238 end at eof.
240 #WRITE <offset> <size> /path/and/filename
242 Hmm, shall we define these ones if we know our client is not going to
243 use them?
246 That's all, folks!
247                                                 pavel@ucw.cz
251 I'm really pavel@atrey.karlin.mff.cuni.cz.         Pavel
252 Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).