.\" -*- nroff -*- .\" .\" sftp2.1 .\" .\" Author: Tomi Salo .\" .\" Copyright (c) 2000, 2002 SSH Communications Security Corp, Finland .\" All rights reserved .\" .TH SFTP2 1 "May 16, 2002" "SSH2" "SSH2" .SH NAME sftp2 \- secure ftp client .SH SYNOPSIS .LP .na .B sftp2 [\c .B \-v\fR\c ] [\c .BI \-D \ debug_level_spec\fR\c ] [\c .BI \-B \ batchfile\fR\c ] [\c .BI \-S \ path\fR\c ] [\c .B \-h\fR\c ] [\c .BI \-P \ port\fR\c ] [\c .BI \-b \ buffer_size\fR\c ] [\c .BI \-N \ max_requests\fR\c ] [\c .B \-V\fR\c ] [\c .B \-4 \c ] [\c .B \-6 \c ] [\c .BI \-c \ cipher\fR\c ] [\c .BI \-m \ MAC\fR\c ] [\c .BI \-o \ ssh-option\fR\c ] [\c user@]host[\c #port] .SH DESCRIPTION .LP \fBsftp2\fR is a ftp-like client that can be used for \fBs\fRecure \fBf\fRile \fBt\fRransfer over the network. \fBsftp2\fR uses \fBssh2\fR to secure traffic. Even though \fBsftp\fR works like \fBftp\fR, it does not use the FTP daemon (\fBftpd\fR or \fBwu-ftpd\fR) for connections. In order to connect using .BR sftp2, you need to make sure that .B sshd2 is running on the remote machine you are connecting to. .B sftp2 uses a "subsystem" of .B sshd2 to transfer files securely (see manpage). .SH OPTIONS .LP .ne 3 .TP .B "-v" Verbose mode. Equivalent to "\fB-D\fR 2". .ne 3 .TP .BI "-D" " debug_level_spec" Debug mode. Makes .B sftp2 send verbose debug output to stderr. The debugging level is a number (0-99). .ne 3 .TP .BI "-B" " batchfile" Batch mode. Reads commands from a file instead of standard input. Since this mode is intended for scripts/cronjobs, .B sftp2 will not try to interact with the user, which means that only passwordless authentication methods will work. In batch mode, a failure to change the current working directory will cause .B sftp2 to abort. Other errors are ignored. .TP .BI "-S" " path" Specifies the path to the .B ssh2 binary. .TP .B "-h" Prints usage information and exits. .TP .BI "-P" " port" Port to connect to on the remote host. This option can also be specified in the configuration file. .TP .BI "-b" " buffer_size" Define the maximum buffer size for one request (default 32768 bytes). .TP .BI "-N" " max_requests" Define the maximum number of concurrent requests (default 10). .TP .B "-V" Prints the version and exits. .TP .B \-4\c Instruct .B ssh2 to use IPv4. .TP .B \-6\c Instruct .B ssh2 to use IPv6. .TP .BI -c \ cipher Select the encryption algorithm. See \fBssh2\fR(1) for more information. .TP .BI -m \ MAC Select the MAC (Message Authentication Code) algorithm. See \fBssh2\fR(1) for more information. .TP .BI -o \ ssh-options Can be used to give options in the format used in the ssh2_config file. This is useful for specifying options for which there is no separate command-line flag. The option has the same format as a line in the configuration file. Comment lines are not accepted. Where applicable, egrep regex format is used. .TP .BI \ user\fR\c Specify the username to use when connecting. (Optional) .TP .BI \ host\fR\c Specify the host to connect to. .TP .BI \ port\fR\c Specify the port on the host to connect to. (Optional) .SH COMMANDS .LP When .B sftp2 is ready to accept commands, it will display a prompt: .BR "'sftp> '" "." The user can then enter any of the following commands. .TP .B open -l\fR or \fBopen\fR hostname Tries to connect to a host specified with .IR hostname . With the \fB-l\fR parameter, the "remote" end is opened to the localhost (without connecting to an .B sshd2 daemon), after which \fBls\fR (for example) will show the contents of the local filesystem. .TP .B lopen -l\fR or \fBlopen\fR hostname Tries to connect to a host specified with .IR hostname . With the \fB-l\fR parameter, the "local" end is opened to the localhost (without connecting to an .B sshd2 daemon), after which \fBlls\fR (for example) will show the contents of the local filesystem. Command "\fBlocalopen\fR" is a synonym for this command. .TP .B close Closes the remote connection. .TP .B lclose Closes the local connection. .TP .B quit Quits the application. .TP .BI cd \ directory Changes the current remote working directory. .TP .BI lcd \ directory Changes the current local working directory. .TP .B pwd Prints the name of the current remote working directory. .TP .B lpwd Prints the name of the current local working directory. .TP .B ls\fR [\fB-R\fR] [\fB-l\fR] [\fB-S\fR] [\fB-r\fR] [\fIfile\fR \fI...\fR] Lists the names of the files on the remote server. For directories, the contents of the directory is listed. When the \fB-R\fR option is specified, all directories are listed recursively. (By default, the subdirectories of the argument directories are not visited.) With \fB-l\fR, permissions, owners, sizes and modification times are displayed. If \fB-S\fR is given, sorting is done based on file sizes (default: alphabetically). If \fB-r\fR is given, the sort order is reversed. When no \fIfile\fR arguments are given, the contents of the current working directory is listed. .TP .B lls\fR [options] [ \fIfile\fR ... ] Same as .BR ls , but operates on local files. .TP .B get\fR [\fB--preserve-attributes\fR] [\fB-p\fR] [\fIfile\fR \fI...\fR] Transfers the specified files from the remote end to the local end. Directories are recursively copied with their contents. If \fB-p\fR,\fB--preserve-attributes\fR is given, sftp tries to retain permissions and timestamps. .TP .B mget \fR[options] [\fIfile\fR \fI...\fR] Synonymous to .BR get . .TP .B put \fR[options] [\fIfile\fR \fI...\fR] Transfers the specified files from the local end to the remote end. Directories are recursively copied with their contents. Options are the same as for .BR get . .TP .B mput \fR[options] [\fIfile\fR \fI...\fR] Synonymous to .BE put . .TP .B rename \fIsource target Renames the file \fIsource\fR to \fItarget\fR. If \fItarget\fR already exists, the files are left intact. .TP .B lrename \fIsource target Same as .BR rename , but operates on local files. .TP .BI rm \ file Tries to delete the specified \fIfile\fR. .TP .BI lrm \ file Same as \fBrm\fR, but operates on local files. .TP .BI mkdir \ directory Tries to create the specified \fIdirectory\fR. .TP .BI lmkdir \ directory Same as \fBmkdir\fR, but operates on local files. .TP .BI rmdir \ directory Tries to delete the specified \fIdirectory\fR. .TP .BI lrmdir \ directory Same as \fBrmdir\fR, but operates on local files. .TP .B help\fR [\fItopic\fR] Lists online help on \fItopic\fR. If \fItopic\fR is not given, lists the available topics. .TP .B lsroots Dumps the virtual roots of the server (this is a VShell (from VanDyke Software) extension, and only usable against that. SSH Communications Security's Windows server displays the file system roots in the unix style, and does not require this extension). .TP .B ascii\fR [\fI-s\fR] [\fI-f\fR] [\fI\fR] [\fI\fR] With the .I -s option, shows current newline convention. .I sets remote newline convention. .I operates on local side, but is not as useful (the correct local newline convention is usually compiled in, so this is mainly for testing). Please note, that these are only hints for the underlying transfer layer, which tries to use the newline convention given by the server wherever possible. You can set either of these to "\fBask\fR", which will cause sftp to prompt you for the newline convention when needed. With the exception of the .I -s option, this command sets transfer mode to ascii, i.e. newlines will be converted according to the conventions. Available conventions are "\fBdos\fR", "\fBunix\fR" or "\fBmac\fR", using "\\r\\n", "\\n" and "\\r" as newlines, respectively. .TP .B binary Files will be transferred unmodified. .TP .B auto Files, whose extension matches the one set with .BR setext , will be transferred using ascii mode. Other files will be transferred unmodified. .TP .B setext\fR \fI\fR [\fI\fR \fI...\fR] Set the file types, which will be transferred in ascii mode, if the transfer mode is auto. Standard zsh-fileglob regexs can be used for matching (only the file extension is matched, i.e. extension "\fI*ml\fR" matches with files \fIfoo.html\fR and \fIbar.ml\fR. .TP .B getext Displays the extensions of files, which will be transferred using ascii (newline) conversion in the auto transfer mode. .SH COMMAND INTERPRETATION .LP .B sftp2 understands both backslashes and quotation marks on the command line. A backslash can be used for ignoring the special meaning of any character in the command-line interpretation. It will be removed even if the character it precedes has no special meaning. Quotation marks can be used for specifying filenames with spaces. The command-line processing and globbing use the same escape character (a backslash), so if you want to use a backslash to escape the meta-characters in the globbing, you have to precede the backslash with another backslash to escape its special meaning from the command line processor. Be warned that if you do \fBget .\fR or \fBput .\fR you will get or put every file in the current directory and possibly override files in your current directory. .SH GLOB PATTERNS .LP .B sftp2 supports glob patterns (wildcards) given to commands \fBls\fR, \fBlls\fR, \fBget\fR, and \fBput\fR. The format is described in the man page .BR sshregex (1). .SH COMMAND-LINE EDITING .LP The following key sequences can be used for command-line editing: .TP .B Ctrl-Space Set mark. .TP .B Ctrl-A Go to the beginning of the line. .TP .B Ctrl-B Move the cursor one character to the left. .TP .B Ctrl-D Erase the character to the right of the cursor, or exit the program if the command line is empty. .TP .B Ctrl-E Go to the end of the line. .TP .B Ctrl-F Move the cursor one character to the right. .TP .B Ctrl-H Backspace. .TP .B Ctrl-I Tab. .TP .B Ctrl-J Enter. .TP .B Ctrl-K Delete the rest of the line. .TP .B Ctrl-L Redraw the line. .TP .B Ctrl-M Enter. .TP .B Ctrl-N Move to the next line. .TP .B Ctrl-P Move to the previous line. .TP .B Ctrl-T Toggle two characters. .TP .B Ctrl-U Delete the line. .TP .B Ctrl-W Delete a region (the region's other end is marked with Ctrl-Space). .TP .B Ctrl-X Begin an extended command. .TP .B Ctrl-Y Yank deleted line. .TP .B Ctrl-_ Undo. .TP .B Ctrl-X Ctrl-L Downcase region. .TP .B Ctrl-X Ctrl-U Upcase region. .TP .B Ctrl-X Ctrl-X Exchange cursor and mark. .TP .B Ctrl-X H Mark the whole buffer. .TP .B Ctrl-X U Undo. .TP .B Esc Ctrl-H Backwards word-delete. .TP .B Esc Delete Backwards word-delete. .TP .B Esc Space Delete extra spaces (leaves only one space). .TP .B Esc < Go to the beginning of the line. .TP .B Esc > Go to the end of the line. .TP .B Esc @ Mark current word. .TP .B Esc A Go one sentence backwards. .TP .B Esc B Go one word backwards. .TP .B Esc C Capitalize current word. .TP .B Esc D Delete current word. .TP .B Esc E Go one sentence forwards. .TP .B Esc F Go one word forwards. .TP .B Esc K Delete current sentence. .TP .B Esc L Lowercase current word. .TP .B Esc T Transpose words. .TP .B Esc U Upcase current word. .TP .B Delete Backspace. .SH AUTHORS .LP SSH Communications Security Corp. For more information, see http://www.ssh.com. .SH SEE ALSO .BR sshregex (1), .BR ssh2 (1), .BR sshd2 (8), .BR ssh-keygen2 (1), .BR ssh-agent2 (1), .BR ssh-add2 (1), .BR scp2 (1)