1sftp(1)                          User Commands                         sftp(1)
2
3
4

NAME

6       sftp - secure file transfer program
7

SYNOPSIS

9       sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]
10             [-o ssh_option] [-P sftp_server_path] [-R num_requests]
11             [-S program] [-s subsystem | sftp_server] host
12
13
14       sftp [[user@]host[:file [file]]]
15
16
17       sftp [[user@]host[:dir[/]]]
18
19
20       sftp -b batchfile [user@]host
21
22

DESCRIPTION

24       The  sftp  utility  is an interactive file transfer program with a user
25       interface similar to ftp(1) that uses the ssh(1) command  to  create  a
26       secure connection to the server.
27
28
29       sftp  implements  the  SSH  File  Transfer  Protocol as defined in IETF
30       draft-ietf-secsh-filexfer. There is no relationship between the  proto‐
31       col used by sftp and the FTP protocol (RFC 959) provided by ftp(1).
32
33
34       The first usage format causes sftp to connect to the specified host and
35       enter an interactive mode. If a username was provided then  sftp  tries
36       to  log  in as the specified user. If a directory is provided then sftp
37       tries to change the current directory on the server  to  the  specified
38       directory before entering the interactive mode.
39
40
41       The  second  usage  format retrieves the specified file from the server
42       and copies it to the specified target file or directory on the  client.
43       If a username is specified sftp tries to log in as the specified user.
44

OPTIONS

46       The following options are supported:
47
48       -b batchfile                  Batch  mode  reads  a  series of commands
49                                     from an input batchfile instead of stdin.
50                                     Since   it  lacks  user  interaction,  it
51                                     should be used in conjunction  with  non-
52                                     interactive  authentication.  A batchfile
53                                     of - can be  used  to  indicate  standard
54                                     input.  sftp aborts if any of the follow‐
55                                     ing commands fail: get, put, rm,  rename,
56                                     ln,  rm, mkdir, chdir, ls, lchdir, chmod,
57                                     chown, chgrp, lpwd, and lmkdir.  Termina‐
58                                     tion on error can be suppressed on a com‐
59                                     mand by command basis  by  prefixing  the
60                                     command  with a - character (for example,
61                                     -rm /tmp/blah*).
62
63
64       -B buffer_size                Specifies the size  of  the  buffer  that
65                                     sftp uses when transferring files. Larger
66                                     buffers require fewer round trips at  the
67                                     cost  of  higher  memory consumption. The
68                                     default is 32768 bytes.
69
70
71       -C                            Enables compression, using the -C flag in
72                                     ssh(1).
73
74
75       -F ssh_config                 Specifies an alternative per-user config‐
76                                     uration file  for  ssh.  This  option  is
77                                     directly passed to ssh(1).
78
79
80       -o ssh_option                 Specifies an option to be directly passed
81                                     to ssh(1).
82
83
84       -P sftp_server path           Executes the specified path as  an  sftp-
85                                     server  and  uses  a pipe, rather than an
86                                     ssh connection, to communicate  with  it.
87                                     This  option  can  be useful in debugging
88                                     the sftp client and server. The -P and -S
89                                     options are mutually exclusive.
90
91
92       -R num_requests               Specifies  how  many requests can be out‐
93                                     standing at any one time. Increasing this
94                                     can  slightly improve file transfer speed
95                                     but increases memory usage.  The  default
96                                     is 16 outstanding requests.
97
98
99       -s subsystem | sftp_server    Specifies  the SSH2 subsystem or the path
100                                     for an sftp server on the remote host.  A
101                                     path is useful for using sftp over proto‐
102                                     col version 1, or when  the  remote  sshd
103                                     does  not  have an sftp subsystem config‐
104                                     ured.
105
106
107       -S ssh_program path           Uses the  specified  program  instead  of
108                                     ssh(1) to connect to the sftp server. The
109                                     -P and -S options are mutually exclusive.
110                                     The   program   must   understand  ssh(1)
111                                     options.
112
113
114       -v                            Raises logging level. This option is also
115                                     passed to ssh(1).
116
117
118       -1                            Specifies the use of protocol version 1.
119
120

OPERANDS

122       The following operands are supported:
123
124       hostname | user@hostname    The name of the host to which sftp connects
125                                   and logs into.
126
127

INTERACTIVE COMMANDS

129       Once in interactive mode, sftp understands a set of commands similar to
130       those  of  ftp(1).  Commands are case insensitive and path names can be
131       enclosed in quotes if they contain spaces.
132
133       bye
134
135           Quits sftp.
136
137
138       cd path
139
140           Changes remote directory to path.
141
142
143       chgrp grp path
144
145           Changes group of file path to grp. grp must be a numeric GID.
146
147
148       chmod mode path
149
150           Changes permissions of file path to mode.
151
152
153       chown own path
154
155           Changes owner of file path to own. own must be a numeric UID.
156
157
158       exit
159
160           Quits sftp.
161
162
163       get [flags] remote-path [local-path]
164
165           Retrieves the remote-path and stores it on the  local  machine.  If
166           the local path name is not specified, it is specified the same name
167           it has on the remote machine. If the -P flag is specified, then the
168           file's full permission and access time are copied too.
169
170
171       help
172
173           Displays help text.
174
175           Identical to the ? command.
176
177
178       lcd path
179
180           Changes local directory to path.
181
182
183       lls [ls-options [path]]
184
185           Displays  local  directory listing of either path or current direc‐
186           tory if path is not specified.
187
188
189       lmkdir path
190
191           Creates local directory specified by path.
192
193
194       ln oldpath newpath
195
196           Creates a link from oldpath to newpath.
197
198
199       lpwd
200
201           Prints local working directory.
202
203
204       ls [-1aflnrSt] [path]
205
206           Displays remote directory listing of either path or current  direc‐
207           tory if path is not specified. path can contain wildcards.
208
209           The ls supports the following options:
210
211           -a    Lists files beginning with a dot (.).
212
213
214           -f    Does  not sort the listing. The default sort order is lexico‐
215                 graphical.
216
217
218           -l    Displays additional details including permissions and  owner‐
219                 ship information.
220
221
222           -n    Produces  a long listing with user and group information pre‐
223                 sented numerically.
224
225
226           -r    Reverses the sort order of the listing.
227
228
229           -S    Sorts the listing by file size.
230
231
232           -t    Sorts the listing by last modification time.
233
234
235           -1    Produces single column output.
236
237
238
239       lumask umask
240
241           Sets local umask to umask.
242
243
244       mkdir path
245
246           Creates remote directory specified by path.
247
248
249       put [flags] local-path [local-path]
250
251           Uploads local-path and stores it on  the  remote  machine.  If  the
252           remote path name is not specified, it is specified the same name it
253           has on the local machine. If the -P flag  is  specified,  then  the
254           file's full permission and access time are copied too.
255
256
257       pwd
258
259           Displays remote working directory.
260
261
262       quit
263
264           Quits sftp.
265
266
267       rename oldpath newpath
268
269           Renames remote file from oldpath to newpath.
270
271
272       rm path
273
274           Deletes remote file specified by path.
275
276
277       rmdir path
278
279           Removes remote directory specified by path.
280
281
282       symlink oldpath newpath
283
284           Creates a symbolic link from oldpath to newpath.
285
286
287       version
288
289           Displays the sftp protocol version.
290
291
292       # [comment]
293
294           Include a comment. This is useful in batch files.
295
296
297       ! [command]
298
299           If command is not specified, escapes to the local shell.
300
301           If command is specified, executes command in the local shell.
302
303
304       ?
305
306           Displays help text.
307
308           Identical to the help command.
309
310

EXIT STATUS

312       The following exit values are returned:
313
314       0     Successful completion.
315
316
317       >0    An error occurred.
318
319

ATTRIBUTES

321       See attributes(5) for descriptions of the following attributes:
322
323
324
325
326       ┌─────────────────────────────┬─────────────────────────────┐
327       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
328       ├─────────────────────────────┼─────────────────────────────┤
329       │Availability                 │SUNWsshu                     │
330       ├─────────────────────────────┼─────────────────────────────┤
331       │Interface Stability          │Committed                    │
332       └─────────────────────────────┴─────────────────────────────┘
333

SEE ALSO

335       ftp(1),    scp(1),   ssh(1),   ssh-add(1),   ssh-keygen(1),   sshd(1M),
336       attributes(5)
337
338
339
340SunOS 5.11                        8 Nov 2007                           sftp(1)
Impressum