Warning, /network/kio-extras/fish/README is written in an unsupported language. File is not indexed.
0001 Overview of kio_fish 0002 ==================== 0003 0004 FISH is a protocol to get filesystem access without special server 0005 software, only using a remote shell. (Hence the name: FIles transferred 0006 over SHell protocol). 0007 It was first devised by Pavel Machek <pavel@bug.ucw.cz> and implemented 0008 as a Midnight Commander vfs module in 1998. 0009 0010 This is a complete client implementation using his original version 0011 0.0.2 protocol, extending it with 2 commands (which are only optional - 0012 should a real FISH server exist on server side that doesn't understand 0013 them, this KIO worker still works, only slower). Moreover, this client does 0014 complete shell metacharacter quoting on all arguments, a fact that is 0015 neccessary but missing from the specs. 0016 Extensions used are: append (APPEND command), copy (COPY command), 0017 lscount (LIST first prints number of files to be listed), lslinks (LIST 0018 shows symlink info instead of info about link targets), lsmime (LIST 0019 determines the MIME type on the server side) 0020 Password and host key queries are handled via dialog boxes. 0021 The goal of this client is to make a remote directory look and feel exactly 0022 like a local directory, with all comfort, only slower. 0023 0024 NOTE: From version 1.1.3 on, compression is no longer turned on auto- 0025 matically. You have to specify it via ~/.ssh/config or wherever 0026 your local ssh client reads its settings. The same goes for all other 0027 connection parameters. OpenSSH for example has a powerful configuration 0028 file syntax which lets you configure access differently for each host, 0029 something I do not intend to duplicate. Read the ssh_config(5) man page 0030 for details. If someone knows the docs to read for commercial ssh please 0031 tell me so I can include that here as well. 0032 0033 Included below is the original posting from the mc mailing list archives. 0034 0035 If perl is installed on the remote machine and in the default PATH, it will 0036 be used to transfer a custom server script which is much faster than 0037 shell-only mode and more predictable as well. The script is stored in a 0038 file called .fishsrv.pl in the working directory directly after login and 0039 will be reused on subsequent connections. 0040 0041 2001/10/07 Jörg Walter <trouble@garni.ch> 0042 0043 0044 0045 From: Pavel Machek <pavel@bug.ucw.cz> 0046 Subject: New virtual filesystem - fish 0047 Date: Tue, 15 Sep 1998 22:30:07 +0200 0048 0049 Hi! 0050 0051 New virtual filesystem has been created, which allows you to access 0052 files on remote computer over rsh/ssh connection, with _no_ server 0053 needed on the other side. To use it from mc or any program using 0054 libvfs.so, do 0055 0056 cd /#sh:user@host.to.connect.to/ 0057 0058 Note that password authentication will not work, so you must be 0059 authenticated using [rs]hosts or RSA key. 0060 0061 For protocol, see mc/vfs/README.fish. If someone wants to write 0062 server, it would be good idea, since it works without server but 0063 performance is not optimal. 0064 0065 Pavel 0066 0067 PS: Protocol looks like this. If you have any comments, it is time to 0068 speak. 0069 0070 0071 FIles transferred over SHell protocol (V 0.0.2) 0072 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0073 0074 This protocol was designed for transferring files over secureshell 0075 (ssh) connection. It can be as well used for transfers over rsh, and 0076 there may be other uses. 0077 0078 Client sends requests of following form: 0079 0080 #FISH_COMMAND 0081 equivalent shell commands, 0082 which may be multiline 0083 0084 Only fish commands are defined here, shell equivalents are for your 0085 information only and will probably vary from implementation to 0086 implementation. Fish commands always have priority: server is 0087 expected to execute fish command if it understands it. If it does not, 0088 however, it can try the luck and execute shell command. 0089 0090 Server's reply is multiline, but alwyas ends with 0091 0092 ### 000<optional text> 0093 0094 line. ### is prefix to mark this line, 000 is return code. Return 0095 codes are superset to those used in ftp. 0096 0097 There are few new exit codes defined: 0098 0099 000 don't know; if there were no previous lines, this marks COMPLETE 0100 success, if they were, it marks failure. 0101 0102 001 don't know; if there were no previous lines, this marks 0103 PRELIMinary success, if they were, it marks failure 0104 0105 Connecting 0106 ~~~~~~~~~~ 0107 Client uses "echo FISH:;/bin/sh" as command executed on remote 0108 machine. This should make it possible for server to distinguish FISH 0109 connections from normal rsh/ssh. 0110 0111 Commands 0112 ~~~~~~~~ 0113 #FISH 0114 echo; start_fish_server; echo '### 200' 0115 0116 This command is sent at the begining. It marks that client wishes to 0117 talk via FISH protocol. #VER command must follow. If server 0118 understands FISH protocol, it has option to put FISH server somewhere 0119 on system path and name it start_fish_server. 0120 0121 #VER 0.0.2 <feature1> <feature2> <...> 0122 echo '### 000' 0123 0124 This command is the second one. It sends client version and extensions 0125 to the server. Server should reply with protocol version to be used, 0126 and list of extensions accepted. 0127 0128 VER 0.0.0 <feature2> 0129 ### 200 0130 0131 #PWD 0132 pwd; echo '### 200' 0133 0134 Server should reply with current directory (in form /abc/def/ghi) 0135 followed by line indicating success. 0136 0137 #LIST /directory 0138 ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g 0139 S$s 0140 d$m $d $y 0141 :$n 0142 "; done ) 0143 ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g 0144 E$a$i 0145 dD$m $d $y 0146 :$n 0147 "; done ) 0148 echo '### 200' 0149 0150 This allows client to list directory or get status information about 0151 single file. Output is in following form (any line except :<filename> 0152 may be ommited): 0153 0154 P<unix permissions> <owner>.<group> 0155 S<size> 0156 d<3-letters month name> <day> <year or HH:MM> 0157 D<year> <month> <day> <hour> <minute> <second>[.1234] 0158 E<major-of-device>,<minor> 0159 :<filename> 0160 L<filename symlink points to> 0161 <blank line to separate items> 0162 0163 Unix permissions are of form X--------- where X is type of 0164 file. Currently, '-' means regular file, 'd' means directory, 'c', 'b' 0165 means character and block device, 'l' means symbolic link, 'p' means 0166 FIFO and 's' means socket. 0167 0168 'd' has three fields: month (one of strings Jan Feb Mar Apr May Jun 0169 Jul Aug Sep Oct Nov Dec), day of month, and third is either single 0170 number indicating year, or HH:MM field (assume current year in such 0171 case). As you've probably noticed, this is pretty broken; it is for 0172 compatibility with ls listing. 0173 0174 #RETR /some/name 0175 ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200' 0176 0177 Server sends line with filesize on it, followed by line with ### 100 0178 indicating partial success, then it sends binary data (exactly 0179 filesize bytes) and follows them with (with no preceeding newline) ### 0180 200. 0181 0182 Note that there's no way to abort running RETR command - except 0183 closing the connection. 0184 0185 #STOR <size> /file/name 0186 <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' 0187 </font></i> 0188 This command is for storing /file/name, which is exactly size bytes 0189 big. You probably think I went crazy. Well, I did not: that strange 0190 cat > /dev/null has purpose to discard any extra data which was not 0191 written to disk (due to for example out of space condition). 0192 0193 [Why? Imagine uploading file with "rm -rf /" line in it.] 0194 0195 #CWD /somewhere 0196 cd /somewhere; echo '### 000' 0197 0198 It is specified here, but I'm not sure how wise idea is to use this 0199 one: it breaks stateless-ness of the protocol. 0200 0201 Following commands should be rather self-explanatory: 0202 0203 #CHMOD 1234 file 0204 chmod 1234 file; echo '### 000' 0205 0206 #DELE /some/path 0207 rm -f /some/path; echo '### 000' 0208 0209 #MKD /some/path 0210 mkdir /some/path; echo '### 000' 0211 0212 #RMD /some/path 0213 rmdir /some/path; echo '### 000' 0214 0215 #RENAME /path/a /path/b 0216 mv /path/a /path/b; echo '### 000' 0217 0218 #LINK /path/a /path/b 0219 ln /path/a /path/b; echo '### 000' 0220 0221 #SYMLINK /path/a /path/b 0222 ln -s /path/a /path/b; echo '### 000' 0223 0224 #CHOWN user /file/name 0225 chown user /file/name; echo '### 000' 0226 0227 #CHGRP group /file/name 0228 chgrp group /file/name; echo '### 000' 0229 0230 #READ <offset> <size> /path/and/filename 0231 cat /path/and/filename | ( dd bs=4096 count=<offset/4096> > /dev/null; 0232 dd bs=<offset%4096> count=1 > /dev/null; 0233 dd bs=4096 count=<offset/4096>; 0234 dd bs=<offset%4096> count=1; ) 0235 0236 Returns ### 200 on successfull exit, ### 291 on successfull exit when 0237 reading ended at eof, ### 292 on successfull exit when reading did not 0238 end at eof. 0239 0240 #WRITE <offset> <size> /path/and/filename 0241 0242 Hmm, shall we define these ones if we know our client is not going to 0243 use them? 0244 0245 0246 That's all, folks! 0247 pavel@ucw.cz 0248 0249 0250 -- 0251 I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel 0252 Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).