sftp.0 revision 189006
15455SdgSFTP(1) OpenBSD Reference Manual SFTP(1) 21541Srgrimes 31541SrgrimesNAME 41541Srgrimes sftp - secure file transfer program 51541Srgrimes 61541SrgrimesSYNOPSIS 71541Srgrimes sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config] 81541Srgrimes [-o ssh_option] [-P sftp_server_path] [-R num_requests] [-S program] 91541Srgrimes [-s subsystem | sftp_server] host 101541Srgrimes sftp [user@]host[:file ...] 111541Srgrimes sftp [user@]host[:dir[/]] 121541Srgrimes sftp -b batchfile [user@]host 131541Srgrimes 141541SrgrimesDESCRIPTION 151541Srgrimes sftp is an interactive file transfer program, similar to ftp(1), which 161541Srgrimes performs all operations over an encrypted ssh(1) transport. It may also 1758705Scharnier use many features of ssh, such as public key authentication and compres- 181541Srgrimes sion. sftp connects and logs into the specified host, then enters an in- 191541Srgrimes teractive command mode. 201541Srgrimes 211541Srgrimes The second usage format will retrieve files automatically if a non-inter- 221541Srgrimes active authentication method is used; otherwise it will do so after suc- 231541Srgrimes cessful interactive authentication. 241541Srgrimes 251541Srgrimes The third usage format allows sftp to start in a remote directory. 261541Srgrimes 271541Srgrimes The final usage format allows for automated sessions using the -b option. 281541Srgrimes In such cases, it is necessary to configure non-interactive authentica- 291541Srgrimes tion to obviate the need to enter a password at connection time (see 301541Srgrimes sshd(8) and ssh-keygen(1) for details). The options are as follows: 311541Srgrimes 321541Srgrimes -1 Specify the use of protocol version 1. 331541Srgrimes 341541Srgrimes -B buffer_size 351541Srgrimes Specify the size of the buffer that sftp uses when transferring 361817Sdg files. Larger buffers require fewer round trips at the cost of 371541Srgrimes higher memory consumption. The default is 32768 bytes. 381541Srgrimes 391541Srgrimes -b batchfile 401541Srgrimes Batch mode reads a series of commands from an input batchfile in- 411541Srgrimes stead of stdin. Since it lacks user interaction it should be 421541Srgrimes used in conjunction with non-interactive authentication. A 435455Sdg batchfile of `-' may be used to indicate standard input. sftp 441541Srgrimes will abort if any of the following commands fail: get, put, 451541Srgrimes rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp, 461541Srgrimes lpwd, df, and lmkdir. Termination on error can be suppressed on 471541Srgrimes a command by command basis by prefixing the command with a `-' 481541Srgrimes character (for example, -rm /tmp/blah*). 495455Sdg 505455Sdg -C Enables compression (via ssh's -C flag). 515455Sdg 521541Srgrimes -F ssh_config 535455Sdg Specifies an alternative per-user configuration file for ssh(1). 541541Srgrimes This option is directly passed to ssh(1). 551541Srgrimes 561541Srgrimes -o ssh_option 571541Srgrimes Can be used to pass options to ssh in the format used in 581541Srgrimes ssh_config(5). This is useful for specifying options for which 591541Srgrimes there is no separate sftp command-line flag. For example, to 601541Srgrimes specify an alternate port use: sftp -oPort=24. For full details 611541Srgrimes of the options listed below, and their possible values, see 621541Srgrimes ssh_config(5). 631817Sdg 6450477Speter AddressFamily 651541Srgrimes BatchMode 661541Srgrimes BindAddress 671541Srgrimes ChallengeResponseAuthentication 681541Srgrimes CheckHostIP 691541Srgrimes Cipher 701541Srgrimes Ciphers 711541Srgrimes Compression 721541Srgrimes CompressionLevel 7376166Smarkm ConnectionAttempts 7476166Smarkm ConnectTimeout 752112Swollman ControlMaster 766129Sdg ControlPath 771541Srgrimes GlobalKnownHostsFile 781541Srgrimes GSSAPIAuthentication 7912662Sdg GSSAPIDelegateCredentials 8012662Sdg HashKnownHosts 8112662Sdg Host 8212662Sdg HostbasedAuthentication 831541Srgrimes HostKeyAlgorithms 841541Srgrimes HostKeyAlias 8512726Sbde HostName 861541Srgrimes IdentityFile 8719830Sdyson IdentitiesOnly 8819830Sdyson KbdInteractiveDevices 8919830Sdyson LogLevel 9019830Sdyson MACs 9119830Sdyson NoHostAuthenticationForLocalhost 9219830Sdyson NumberOfPasswordPrompts 9319830Sdyson PasswordAuthentication 942112Swollman Port 951541Srgrimes PreferredAuthentications 961541Srgrimes Protocol 971541Srgrimes ProxyCommand 981541Srgrimes PubkeyAuthentication 9912259Sdg RekeyLimit 1001541Srgrimes RhostsRSAAuthentication 1011541Srgrimes RSAAuthentication 1028876Srgrimes SendEnv 1035455Sdg ServerAliveInterval 1045455Sdg ServerAliveCountMax 10570480Salfred SmartcardDevice 1061541Srgrimes StrictHostKeyChecking 1075455Sdg TCPKeepAlive 10870480Salfred UsePrivilegedPort 1091541Srgrimes User 1101541Srgrimes UserKnownHostsFile 1111541Srgrimes VerifyHostKeyDNS 1121541Srgrimes 11313490Sdyson -P sftp_server_path 1141541Srgrimes Connect directly to a local sftp server (rather than via ssh(1)). 1155455Sdg This option may be useful in debugging the client and server. 1161541Srgrimes 1175455Sdg -R num_requests 1181541Srgrimes Specify how many requests may be outstanding at any one time. 1191541Srgrimes Increasing this may slightly improve file transfer speed but will 1201541Srgrimes increase memory usage. The default is 64 outstanding requests. 12147841Sdt 12247841Sdt -S program 12347841Sdt Name of the program to use for the encrypted connection. The 12447841Sdt program must understand ssh(1) options. 12547841Sdt 12647841Sdt -s subsystem | sftp_server 12747841Sdt Specifies the SSH2 subsystem or the path for an sftp server on 12847841Sdt the remote host. A path is useful for using sftp over protocol 12970480Salfred version 1, or when the remote sshd(8) does not have an sftp sub- 13047841Sdt system configured. 13147841Sdt 13270480Salfred -v Raise logging level. This option is also passed to ssh. 13347841Sdt 13447841SdtINTERACTIVE COMMANDS 13547841Sdt Once in interactive mode, sftp understands a set of commands similar to 13647841Sdt those of ftp(1). Commands are case insensitive. Pathnames that contain 13747841Sdt spaces must be enclosed in quotes. Any special characters contained 13847841Sdt within pathnames that are recognized by glob(3) must be escaped with 13947841Sdt backslashes (`\'). 14047841Sdt 14147841Sdt bye Quit sftp. 14247841Sdt 14347841Sdt cd path 14447841Sdt Change remote directory to path. 1451541Srgrimes 1461541Srgrimes chgrp grp path 1471541Srgrimes Change group of file path to grp. path may contain glob(3) char- 1488876Srgrimes acters and may match multiple files. grp must be a numeric GID. 1495455Sdg 15070480Salfred chmod mode path 15170480Salfred Change permissions of file path to mode. path may contain 1521541Srgrimes glob(3) characters and may match multiple files. 1535455Sdg 15470480Salfred chown own path 1555455Sdg Change owner of file path to own. path may contain glob(3) char- 1561541Srgrimes acters and may match multiple files. own must be a numeric UID. 15771571Sjhb 1581541Srgrimes df [-hi] [path] 1591541Srgrimes Display usage information for the filesystem holding the current 1601541Srgrimes directory (or path if specified). If the -h flag is specified, 1615455Sdg the capacity information will be displayed using "human-readable" 1625455Sdg suffixes. The -i flag requests display of inode information in 1631541Srgrimes addition to capacity information. This command is only supported 1641541Srgrimes on servers that implement the ``statvfs@openssh.com'' extension. 1651541Srgrimes 1665455Sdg exit Quit sftp. 1675455Sdg 1685455Sdg get [-P] remote-path [local-path] 1691541Srgrimes Retrieve the remote-path and store it on the local machine. If 1701541Srgrimes the local path name is not specified, it is given the same name 17133758Sdyson it has on the remote machine. remote-path may contain glob(3) 1721541Srgrimes characters and may match multiple files. If it does and local- 1731541Srgrimes path is specified, then local-path must specify a directory. If 1741541Srgrimes the -P flag is specified, then full file permissions and access 1751541Srgrimes times are copied too. 1761541Srgrimes 17713490Sdyson help Display help text. 17813490Sdyson 1791541Srgrimes lcd path 1801541Srgrimes Change local directory to path. 1811541Srgrimes 1825455Sdg lls [ls-options [path]] 1835455Sdg Display local directory listing of either path or current direc- 1845455Sdg tory if path is not specified. ls-options may contain any flags 1858876Srgrimes supported by the local system's ls(1) command. path may contain 1865455Sdg glob(3) characters and may match multiple files. 1875455Sdg 1885455Sdg lmkdir path 1895455Sdg Create local directory specified by path. 1905455Sdg 1915455Sdg ln oldpath newpath 1925455Sdg Create a symbolic link from oldpath to newpath. 1935455Sdg 1948876Srgrimes lpwd Print local working directory. 1955455Sdg 1965455Sdg ls [-1aflnrSt] [path] 1971541Srgrimes Display a remote directory listing of either path or the current 1981541Srgrimes directory if path is not specified. path may contain glob(3) 1995455Sdg characters and may match multiple files. 2005455Sdg 2011541Srgrimes The following flags are recognized and alter the behaviour of ls 20233109Sdyson accordingly: 20333109Sdyson 20410548Sdyson -1 Produce single columnar output. 20510548Sdyson 2066585Sdg -a List files beginning with a dot (`.'). 20742957Sdillon 20842957Sdillon -f Do not sort the listing. The default sort order is lexi- 2091541Srgrimes cographical. 2105455Sdg 2111541Srgrimes -l Display additional details including permissions and own- 2125455Sdg ership information. 2131541Srgrimes 2141541Srgrimes -n Produce a long listing with user and group information 2151541Srgrimes presented numerically. 2161541Srgrimes 2175455Sdg -r Reverse the sort order of the listing. 2181541Srgrimes 2191541Srgrimes -S Sort the listing by file size. 2201541Srgrimes 2211541Srgrimes -t Sort the listing by last modification time. 2221541Srgrimes 2231541Srgrimes lumask umask 2241541Srgrimes Set local umask to umask. 2251541Srgrimes 22642957Sdillon mkdir path 22742957Sdillon Create remote directory specified by path. 2281541Srgrimes 2298876Srgrimes progress 2305455Sdg Toggle display of progress meter. 2315455Sdg 23270480Salfred put [-P] local-path [remote-path] 2335455Sdg Upload local-path and store it on the remote machine. If the re- 2341541Srgrimes mote path name is not specified, it is given the same name it has 23571571Sjhb on the local machine. local-path may contain glob(3) characters 23671571Sjhb and may match multiple files. If it does and remote-path is 2371541Srgrimes specified, then remote-path must specify a directory. If the -P 2381541Srgrimes flag is specified, then the file's full permission and access 2391541Srgrimes time are copied too. 2401541Srgrimes 2411541Srgrimes pwd Display remote working directory. 2421541Srgrimes 2431541Srgrimes quit Quit sftp. 2441541Srgrimes 2451541Srgrimes rename oldpath newpath 2461541Srgrimes Rename remote file from oldpath to newpath. 2471541Srgrimes 2481541Srgrimes rm path 24970480Salfred Delete remote file specified by path. 2501541Srgrimes 2511541Srgrimes rmdir path 2528876Srgrimes Remove remote directory specified by path. 25332702Sdyson 25470478Salfred symlink oldpath newpath 2555455Sdg Create a symbolic link from oldpath to newpath. 25670478Salfred 2571541Srgrimes version 25870478Salfred Display the sftp protocol version. 2595455Sdg 2601541Srgrimes !command 2611541Srgrimes Execute command in local shell. 2621541Srgrimes 2631541Srgrimes ! Escape to local shell. 2641541Srgrimes 26513490Sdyson ? Synonym for help. 2661541Srgrimes 2671541SrgrimesSEE ALSO 2681541Srgrimes ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3), 2691541Srgrimes ssh_config(5), sftp-server(8), sshd(8) 2701541Srgrimes 2711541Srgrimes T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- 27232702Sdyson filexfer-00.txt, January 2001, work in progress material. 2731541Srgrimes 2741541SrgrimesOpenBSD 4.5 December 9, 2008 5 27570478Salfred