| Network Working Group Request for Comments: 913 | Mark K. Lottor MIT September 1984 |
<NULL>. The argument can sometimes be null in which case the command
is just 4 characters followed by <NULL>. Replies from the server are
always a response character followed immediately by an ASCII message
string terminated by a <NULL>. A reply can also be just a response
character and a <NULL>.
<command> : = <cmd> [<SPACE> <args>] <NULL>
<cmd> : = USER ! ACCT ! PASS ! TYPE ! LIST ! CDIR
KILL ! NAME ! DONE ! RETR ! STOR
<response> : = <response-code> [<message>] <NULL>
<response-code> : = + | - | | !
<message> can contain <CRLF>
Commands that can be sent to the server are listed below. The server
RFC 913 September 1984
+ Success.
- Error.
An error occurred while processing your command.
Number.
The number-sign is followed immediately by ASCII digits
representing a decimal number.
! Logged in.
You have sent enough information to be able to log yourself in.
This is also used to mean you have sent enough information to
connect to a directory.
To use SFTP you first open a connection to the remote SFTP server.
The server replies by sending either a positive or negative greeting,
such as:
+MIT-XX SFTP Service
(the first word should be the host name)
-MIT-XX Out to Lunch
RFC 913 September 1984
+User-id valid, send account and password
-Invalid user-id, try again
If the remote system does not have user-id's then you should
send an identification such as your personal name or host name
as the argument, and the remote system would reply with '+'.
ACCT account
The account you want to use (usually used for billing) on the
remote system.
Valid replies are:
! Account valid, logged-in
Account was ok or not needed. Skip the password.
+Account valid, send password
Account ok or not needed. Send your password next.
-Invalid account, try again
RFC 913 September 1984
+Send account
Password ok but you haven't specified the account.
-Wrong password, try again
RFC 913 September 1984
RFC 913 September 1984
+Using { Ascii | Binary | Continuous } mode
-Type not valid
RFC 913 September 1984
<CRLF>. The listing is terminated with a <NULL> after the
last <CRLF>.
V specifies a verbose directory listing.
An error returns '-' as above. A verbose directory listing
is a '+' followed immediately by the current directory path
specification and a <CRLF>. It is then followed by one line
per file in the directory (a line ending in <CRLF>). The
line returned for each file can be of any format. Possible
information to return would be the file name, size,
protection, last write date, and name of last writer.
RFC 913 September 1984
-Can't connect to directory because: (reason)
+directory ok, send account/password
If the server replies with '+' you should then send an ACCT or
PASS command. The server will wait for ACCT or PASS commands
until it returns a '-' or '!' response.
Replies to ACCT could be:
!Changed working dir to <new-directory>
+account ok, send password
-invalid account
Replies to PASS could be:
!Changed working dir to <new-directory>
+password ok, send account
-invalid password
KILL file-spec
This will delete the file from the remote system.
Replies are:
+<file-spec> deleted
-Not deleted because (reason)
RFC 913 September 1984
+File exists
-Can't find <old-file-spec>
NAME command is aborted, don't send TOBE.
If you receive a '+' you then send:
TOBE new-file-spec
The server replies with:
+<old-file-spec> renamed to <new-file-spec>
-File wasn't renamed because (reason)
DONE
Tells the remote system you are done.
The remote system replies:
+(the message may be charge/accounting info)
and then both systems close the connection.
RFC 913 September 1984
<number-of-bytes-that-will-be-sent> (as ascii digits)
-File doesn't exist
You then reply to the remote system with:
SEND (ok, waiting for file)
The file is then sent as a stream of exactly the number
of 8-bit bytes specified. When all bytes are received
control passes back to you (the remote system is waiting
for the next command). If you don't receive a byte
within a reasonable amount of time you should abort the
file transfer by closing the connection.
STOP (You don't have enough space to store file)
Replies could be:
+ok, RETR aborted
You are then ready to send another command to the remote host.
RFC 913 September 1984
+File exists, will create new generation of file
+File does not exist, will create new file
-File exists, but system doesn't support generations
OLD specifies it should write over the existing file, if any,
or else create a new file with the specified name.
Replies could be:
+Will write over old file
+Will create new file
(OLD should always return a '+')
APP specifies that what you send should be appended to the file
on the remote site. If the file doesn't exist it will be
created.
Replies could be:
+Will append to file
+Will create file
(APP should always return a '+')
RFC 913 September 1984
+ok, waiting for file
You then send the file as exactly the number of bytes
specified above.
When you are done the remote system should reply:
+Saved <file-spec>
-Couldn't save because (reason)
-Not enough room, don't send it
This aborts the STOR sequence, the server is waiting for
your next command.
You are then ready to send another command to the remote host.
RFC 913 September 1984
R: (listening for connection)
S: (opens connection to R)
R: +MIT-XX SFTP Service
S: USER MKL
R: +MKL ok, send password
S: PASS foo
R: ! MKL logged in
S: LIST F PS: <MKL>
R: +PS: <MKL>
Small.File
Large.File
S: LIST V
R: +PS: <MKL>
Small.File 1 69(7) P775240 2-Aug-84 20:08 MKL
Large.File 100 255999(8) P770000 9-Dec-84 06:04 MKL
S: RETR SMALL.FILE
R: 69
S: SEND
R: This is a small file, the file is sent without
a terminating null.
S: DONE
R: +MIT-XX closing connection
RFC 913 September 1984
RFC 913 September 1984
-- jon postel.