SFTP2(1)

NAME
sftp2 - secure ftp client

SYNOPSIS

sftp2 [-v ] [-D debug_level_spec ] [-B batchfile ] [-S path ] [-h ] [-P port ] [-b buffer_size ] [-N max_requests ] [-V ] [-4 ] [-6 ] [-c cipher ] [-m MAC ] [-o ssh-option ] [user@]host[#port]

DESCRIPTION

sftp2 is a ftp-like client that can be used for secure file transfer over the network. sftp2 uses ssh2 to secure traffic. Even though sftp works like ftp, it does not use the FTP daemon (ftpd or wu-ftpd) for connections.

In order to connect using sftp2, you need to make sure that sshd2 is running on the remote machine you are connecting to. sftp2 uses a "subsystem" of sshd2 to transfer files securely (see manpage).

OPTIONS

-v  Verbose mode. Equivalent to "-D 2".

-D debug_level_spec
    Debug mode. Makes sftp2 send verbose debug output to stderr. The debugging level is a number (0-99).

-B batchfile
    Batch mode. Reads commands from a file instead of standard input. Since this mode is intended for scripts/cronjobs, 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 sftp2 to abort. Other errors are ignored.

-S path
    Specifies the path to the ssh2 binary.

-h  Prints usage information and exits.

-P port
    Port to connect to on the remote host. This option can also be specified in the configuration file.

-b buffer_size
    Define the maximum buffer size for one request (default 32768 bytes).

-N max_requests
    Define the maximum number of concurrent requests (default 10).

-V  Prints the version and exits.

-4  Instruct ssh2 to use IPv4.

-6  Instruct ssh2 to use IPv6.

-c cipher
    Select the encryption algorithm. See ssh2(1) for more information.

-m MAC
    Select the MAC (Message Authentication Code) algorithm. See ssh2(1) for more information.

-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.

user
    Specify the username to use when connecting. (Optional)

host
    Specify the host to connect to.

port
    Specify the port on the host to connect to. (Optional)

COMMANDS

When sftp2 is ready to accept commands, it will display a prompt: 'sftp> '. The user can then enter any of the following commands.

open -l or open hostname
    Tries to connect to a host specified with hostname. With the -l parameter, the "remote" end is opened to the localhost (without connecting to an sshd2 daemon), after which ls (for example) will show the contents of the local filesystem.

lopen -l or lopen hostname
    Tries to connect to a host specified with hostname. With the -l parameter, the "local" end is opened to the localhost (without connecting to an sshd2 daemon), after which lls (for example) will show the contents of the local filesystem. Command "localopen" is a synonym for this command.

close
    Closes the remote connection.

lclose
    Closes the local connection.

quit
    Quits the application.

cd directory
    Changes the current remote working directory.

lcd directory
    Changes the current local working directory.

pwd Prints the name of the current remote working directory.

lpwd
    Prints the name of the current local working directory.

ls [-R] [-l] [-S] [-r] [file ...]
    Lists the names of the files on the remote server. For directories, the contents of the directory is listed. When the -R option is specified, all directories are listed recursively. (By default, the subdirectories of the argument directories are not visited.) With -l, permissions, owners, sizes and modification times are displayed. If -S is given, sorting is done based on file sizes (default: alphabetically). If -r is given, the sort order is reversed. When no file arguments are given, the contents of the current working directory is listed.

lls [options] [ file ... ]
    Same as ls, but operates on local files.

get [--preserve-attributes] [-p] [file ...]
    Transfers the specified files from the remote end to the local end. Directories are recursively copied with their contents. If -p,--preserve-attributes is given, sftp tries to retain permissions and timestamps.

mget [options] [file ...]
    Synonymous to get.

put [options] [file ...]
    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 get.

mput [options] [file ...]
    Synonymous to

rename source target
    Renames the file source to target. If target already exists, the files are left intact.

lrename source target
    Same as rename, but operates on local files.

rm file
    Tries to delete the specified file.

lrm file
    Same as rm, but operates on local files.

mkdir directory
    Tries to create the specified directory.

lmkdir directory
    Same as mkdir, but operates on local files.

rmdir directory
    Tries to delete the specified directory.

lrmdir directory
    Same as rmdir, but operates on local files.

help [topic]
    Lists online help on topic. If topic is not given, lists the available topics.

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).

ascii [-s] [-f] [<remote_nl_conv>] [<local_nl_conv>]
    With the -s option, shows current newline convention. <remote_nl_conv> sets remote newline convention. <local_nl_conv> 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 "ask", which will cause sftp to prompt you for the newline convention when needed. With the exception of the -s option, this command sets transfer mode to ascii, i.e. newlines will be converted according to the conventions. Available conventions are "dos", "unix" or "mac", using "\r\n", "\n" and "\r" as newlines, respectively.

binary
    Files will be transferred unmodified.

auto
    Files, whose extension matches the one set with setext, will be transferred using ascii mode. Other files will be transferred unmodified.

setext <extension> [<extension> ...]
    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 "*ml" matches with files foo.html and bar.ml.

getext
    Displays the extensions of files, which will be transferred using ascii (newline) conversion in the auto transfer mode.

COMMAND INTERPRETATION

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 get . or put . you will get or put every file in the current directory and possibly override files in your current directory.

GLOB PATTERNS

sftp2 supports glob patterns (wildcards) given to commands ls, lls, get, and put. The format is described in the man page sshregex(1).

COMMAND-LINE EDITING

The following key sequences can be used for command-line editing:

Ctrl-Space
    Set mark.

Ctrl-A
    Go to the beginning of the line.

Ctrl-B
    Move the cursor one character to the left.

Ctrl-D
    Erase the character to the right of the cursor, or exit the program if the command line is empty.

Ctrl-E
    Go to the end of the line.

Ctrl-F
    Move the cursor one character to the right.

Ctrl-H
    Backspace.

Ctrl-I
    Tab.

Ctrl-J
    Enter.

Ctrl-K
    Delete the rest of the line.

Ctrl-L
    Redraw the line.

Ctrl-M
    Enter.

Ctrl-N
    Move to the next line.

Ctrl-P
    Move to the previous line.

Ctrl-T
    Toggle two characters.

Ctrl-U
    Delete the line.

Ctrl-W
    Delete a region (the region's other end is marked with Ctrl-Space).

Ctrl-X
    Begin an extended command.

Ctrl-Y
    Yank deleted line.

Ctrl-_
    Undo.

Ctrl-X Ctrl-L
    Downcase region.

Ctrl-X Ctrl-U
    Upcase region.

Ctrl-X Ctrl-X
    Exchange cursor and mark.

Ctrl-X H
    Mark the whole buffer.

Ctrl-X U
    Undo.

Esc Ctrl-H
    Backwards word-delete.

Esc Delete
    Backwards word-delete.

Esc Space
    Delete extra spaces (leaves only one space).

Esc <
    Go to the beginning of the line.

Esc >
    Go to the end of the line.

Esc @
    Mark current word.

Esc A
    Go one sentence backwards.

Esc B
    Go one word backwards.

Esc C
    Capitalize current word.

Esc D
    Delete current word.

Esc E
    Go one sentence forwards.

Esc F
    Go one word forwards.

Esc K
    Delete current sentence.

Esc L
    Lowercase current word.

Esc T
    Transpose words.

Esc U
    Upcase current word.

Delete
    Backspace.

AUTHORS

SSH Communications Security Corp. For more information, see http://www.ssh.com.

SEE ALSO
sshregex(1), ssh2(1), sshd2(8), ssh-keygen2(1), ssh-agent2(1), ssh-add2(1), scp2(1)