1 '\" te
   2 .\" To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the specified path to access
   3 .\" the file at the installed location.
   4 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
   5 .TH SFTP 1 "Nov 8, 2007"
   6 .SH NAME
   7 sftp \- secure file transfer program
   8 .SH SYNOPSIS
   9 .LP
  10 .nf
  11 \fBsftp\fR [\fB-1Cv\fR] [\fB-B\fR \fIbuffer_size\fR] [\fB-b\fR \fIbatchfile\fR] [\fB-F\fR \fIssh_config\fR]
  12       [\fB-o\fR \fIssh_option\fR] [\fB-P\fR \fIsftp_server_path\fR] [\fB-R\fR \fInum_requests\fR]
  13       [\fB-S\fR \fIprogram\fR] [\fB-s\fR \fIsubsystem\fR | \fIsftp_server\fR] \fIhost\fR
  14 .fi
  15 
  16 .LP
  17 .nf
  18 \fBsftp\fR [[\fIuser\fR\fB@\fR]\fIhost\fR[\fB:\fR\fIfile\fR [\fIfile\fR]]]
  19 .fi
  20 
  21 .LP
  22 .nf
  23 \fBsftp\fR [[\fIuser\fR\fB@\fR]\fIhost\fR[:\fIdir\fR[\fB/\fR]]]
  24 .fi
  25 
  26 .LP
  27 .nf
  28 \fBsftp\fR \fB-b\fR \fIbatchfile\fR [\fIuser\fR\fB@\fR]\fIhost\fR
  29 .fi
  30 
  31 .SH DESCRIPTION
  32 .LP
  33 The \fBsftp\fR utility is an interactive file transfer program with a user
  34 interface similar to \fBftp\fR(1) that uses the \fBssh\fR(1) command to create
  35 a secure connection to the server.
  36 .sp
  37 .LP
  38 \fBsftp\fR implements the SSH File Transfer Protocol as defined in IETF
  39 \fBdraft-ietf-secsh-filexfer\fR. There is no relationship between the protocol
  40 used by \fBsftp\fR and the FTP protocol (\fIRFC 959\fR) provided by
  41 \fBftp\fR(1).
  42 .sp
  43 .LP
  44 The first usage format causes \fBsftp\fR to connect to the specified host and
  45 enter an interactive mode. If a username was provided then \fBsftp\fR tries to
  46 log in as the specified user. If a directory is provided then \fBsftp\fR tries
  47 to change the current directory on the server to the specified directory before
  48 entering the interactive mode.
  49 .sp
  50 .LP
  51 The second usage format retrieves the specified file from the server and copies
  52 it to the specified target file or directory on the client. If a username is
  53 specified \fBsftp\fR tries to log in as the specified user.
  54 .SH OPTIONS
  55 .LP
  56 The following options are supported:
  57 .sp
  58 .ne 2
  59 .na
  60 \fB\fB-b\fR \fIbatchfile\fR\fR
  61 .ad
  62 .RS 30n
  63 Batch mode reads a series of commands from an input \fIbatchfile\fR instead of
  64 \fBstdin\fR. Since it lacks user interaction, it should be used in conjunction
  65 with non-interactive authentication. A batchfile of \fB-\fR can be used to
  66 indicate standard input. \fBsftp\fR aborts if any of the following commands
  67 fail: \fBget\fR, \fBput\fR, \fBrm\fR, \fBrename\fR, \fBln\fR, \fBrm\fR,
  68 \fBmkdir\fR, \fBchdir\fR, \fBls\fR, \fBlchdir\fR, \fBchmod\fR, \fBchown\fR,
  69 \fBchgrp\fR, \fBlpwd\fR, and \fBlmkdir\fR. Termination on error can be
  70 suppressed on a command by command basis by prefixing the command with a
  71 \fB-\fR character (for example, \fB-rm /tmp/blah*\fR).
  72 .RE
  73 
  74 .sp
  75 .ne 2
  76 .na
  77 \fB\fB-B\fR \fIbuffer_size\fR\fR
  78 .ad
  79 .RS 30n
  80 Specifies the size of the buffer that \fBsftp\fR uses when transferring files.
  81 Larger buffers require fewer round trips at the cost of higher memory
  82 consumption. The default is 32768 bytes.
  83 .RE
  84 
  85 .sp
  86 .ne 2
  87 .na
  88 \fB\fB-C\fR\fR
  89 .ad
  90 .RS 30n
  91 Enables compression, using the \fB-C\fR flag in \fBssh\fR(1).
  92 .RE
  93 
  94 .sp
  95 .ne 2
  96 .na
  97 \fB\fB-F\fR \fIssh_config\fR\fR
  98 .ad
  99 .RS 30n
 100 Specifies an alternative per-user configuration file for \fBssh\fR. This option
 101 is directly passed to \fBssh\fR(1).
 102 .RE
 103 
 104 .sp
 105 .ne 2
 106 .na
 107 \fB\fB-o\fR \fIssh_option\fR\fR
 108 .ad
 109 .RS 30n
 110 Specifies an option to be directly passed to \fBssh\fR(1).
 111 .RE
 112 
 113 .sp
 114 .ne 2
 115 .na
 116 \fB\fB-P\fR \fIsftp_server path\fR\fR
 117 .ad
 118 .RS 30n
 119 Executes the specified path as an \fIsftp-server\fR and uses a pipe, rather
 120 than an \fBssh\fR connection, to communicate with it. This option can be useful
 121 in debugging the \fBsftp\fR client and server. The \fB-P\fR and \fB-S\fR
 122 options are mutually exclusive.
 123 .RE
 124 
 125 .sp
 126 .ne 2
 127 .na
 128 \fB\fB-R\fR \fInum_requests\fR\fR
 129 .ad
 130 .RS 30n
 131 Specifies how many requests can be outstanding at any one time. Increasing this
 132 can slightly improve file transfer speed but increases memory usage. The
 133 default is 16 outstanding requests.
 134 .RE
 135 
 136 .sp
 137 .ne 2
 138 .na
 139 \fB\fB-s\fR \fIsubsystem\fR | \fIsftp_server\fR\fR
 140 .ad
 141 .RS 30n
 142 Specifies the \fBSSH2\fR subsystem or the path for an \fBsftp\fR server on the
 143 remote host. A path is useful for using \fBsftp\fR over protocol version 1, or
 144 when the remote \fBsshd\fR does not have an \fBsftp\fR subsystem configured.
 145 .RE
 146 
 147 .sp
 148 .ne 2
 149 .na
 150 \fB\fB-S\fR \fIssh_program\fR \fIpath\fR\fR
 151 .ad
 152 .RS 30n
 153 Uses the specified program instead of \fBssh\fR(1) to connect to the \fBsftp\fR
 154 server. The \fB-P\fR and \fB-S\fR options are mutually exclusive. The program
 155 must understand \fBssh\fR(1) options.
 156 .RE
 157 
 158 .sp
 159 .ne 2
 160 .na
 161 \fB\fB-v\fR\fR
 162 .ad
 163 .RS 30n
 164 Raises logging level. This option is also passed to \fBssh\fR(1).
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB\fB-1\fR\fR
 171 .ad
 172 .RS 30n
 173 Specifies the use of protocol version 1.
 174 .RE
 175 
 176 .SH OPERANDS
 177 .LP
 178 The following operands are supported:
 179 .sp
 180 .ne 2
 181 .na
 182 \fB\fIhostname\fR | \fIuser@hostname\fR\fR
 183 .ad
 184 .RS 28n
 185 The name of the host to which \fBsftp\fR connects and logs into.
 186 .RE
 187 
 188 .SH INTERACTIVE COMMANDS
 189 .LP
 190 Once in interactive mode, \fBsftp\fR understands a set of commands similar to
 191 those of \fBftp\fR(1). Commands are case insensitive and path names can be
 192 enclosed in quotes if they contain spaces.
 193 .sp
 194 .ne 2
 195 .na
 196 \fB\fBbye\fR\fR
 197 .ad
 198 .sp .6
 199 .RS 4n
 200 Quits \fBsftp\fR.
 201 .RE
 202 
 203 .sp
 204 .ne 2
 205 .na
 206 \fB\fBcd\fR \fIpath\fR\fR
 207 .ad
 208 .sp .6
 209 .RS 4n
 210 Changes remote directory to \fIpath\fR.
 211 .RE
 212 
 213 .sp
 214 .ne 2
 215 .na
 216 \fB\fBchgrp\fR \fIgrp path\fR\fR
 217 .ad
 218 .sp .6
 219 .RS 4n
 220 Changes group of file \fIpath\fR to \fIgrp\fR. \fIgrp\fR must be a numeric
 221 \fBGID\fR.
 222 .RE
 223 
 224 .sp
 225 .ne 2
 226 .na
 227 \fB\fBchmod\fR \fImode path\fR\fR
 228 .ad
 229 .sp .6
 230 .RS 4n
 231 Changes permissions of file \fIpath\fR to \fImode\fR.
 232 .RE
 233 
 234 .sp
 235 .ne 2
 236 .na
 237 \fB\fBchown\fR \fIown path\fR\fR
 238 .ad
 239 .sp .6
 240 .RS 4n
 241 Changes owner of file \fIpath\fR to \fIown\fR. \fIown\fR must be a numeric
 242 \fBUID\fR.
 243 .RE
 244 
 245 .sp
 246 .ne 2
 247 .na
 248 \fB\fBexit\fR\fR
 249 .ad
 250 .sp .6
 251 .RS 4n
 252 Quits \fBsftp\fR.
 253 .RE
 254 
 255 .sp
 256 .ne 2
 257 .na
 258 \fB\fBget\fR [\fIflags\fR] \fIremote-path\fR [\fIlocal-path\fR]\fR
 259 .ad
 260 .sp .6
 261 .RS 4n
 262 Retrieves the \fIremote-path\fR and stores it on the local machine. If the
 263 local path name is not specified, it is specified the same name it has on the
 264 remote machine. If the \fB-P\fR flag is specified, then the file's full
 265 permission and access time are copied too.
 266 .RE
 267 
 268 .sp
 269 .ne 2
 270 .na
 271 \fB\fBhelp\fR\fR
 272 .ad
 273 .sp .6
 274 .RS 4n
 275 Displays help text.
 276 .sp
 277 Identical to the \fB?\fR command.
 278 .RE
 279 
 280 .sp
 281 .ne 2
 282 .na
 283 \fB\fBlcd\fR \fIpath\fR\fR
 284 .ad
 285 .sp .6
 286 .RS 4n
 287 Changes local directory to \fIpath\fR.
 288 .RE
 289 
 290 .sp
 291 .ne 2
 292 .na
 293 \fB\fBlls\fR [\fIls-options\fR [\fIpath\fR]]\fR
 294 .ad
 295 .sp .6
 296 .RS 4n
 297 Displays local directory listing of either \fIpath\fR or current directory if
 298 \fIpath\fR is not specified.
 299 .RE
 300 
 301 .sp
 302 .ne 2
 303 .na
 304 \fB\fBlmkdir\fR \fIpath\fR\fR
 305 .ad
 306 .sp .6
 307 .RS 4n
 308 Creates local directory specified by \fIpath\fR.
 309 .RE
 310 
 311 .sp
 312 .ne 2
 313 .na
 314 \fB\fBln\fR \fIoldpath\fR \fInewpath\fR\fR
 315 .ad
 316 .sp .6
 317 .RS 4n
 318 Creates a link from \fIoldpath\fR to \fInewpath\fR.
 319 .RE
 320 
 321 .sp
 322 .ne 2
 323 .na
 324 \fB\fBlpwd\fR\fR
 325 .ad
 326 .sp .6
 327 .RS 4n
 328 Prints local working directory.
 329 .RE
 330 
 331 .sp
 332 .ne 2
 333 .na
 334 \fB\fBls\fR [\fB-1aflnrSt\fR] [\fIpath\fR]\fR
 335 .ad
 336 .sp .6
 337 .RS 4n
 338 Displays remote directory listing of either \fIpath\fR or current directory if
 339 \fIpath\fR is not specified. \fIpath\fR can contain wildcards.
 340 .sp
 341 The \fBls\fR supports the following options:
 342 .sp
 343 .ne 2
 344 .na
 345 \fB\fB-a\fR\fR
 346 .ad
 347 .RS 6n
 348 Lists files beginning with a dot (\fB\&.\fR).
 349 .RE
 350 
 351 .sp
 352 .ne 2
 353 .na
 354 \fB\fB-f\fR\fR
 355 .ad
 356 .RS 6n
 357 Does not sort the listing. The default sort order is lexicographical.
 358 .RE
 359 
 360 .sp
 361 .ne 2
 362 .na
 363 \fB\fB-l\fR\fR
 364 .ad
 365 .RS 6n
 366 Displays additional details including permissions and ownership information.
 367 .RE
 368 
 369 .sp
 370 .ne 2
 371 .na
 372 \fB\fB-n\fR\fR
 373 .ad
 374 .RS 6n
 375 Produces a long listing with user and group information presented numerically.
 376 .RE
 377 
 378 .sp
 379 .ne 2
 380 .na
 381 \fB\fB-r\fR\fR
 382 .ad
 383 .RS 6n
 384 Reverses the sort order of the listing.
 385 .RE
 386 
 387 .sp
 388 .ne 2
 389 .na
 390 \fB\fB-S\fR\fR
 391 .ad
 392 .RS 6n
 393 Sorts the listing by file size.
 394 .RE
 395 
 396 .sp
 397 .ne 2
 398 .na
 399 \fB\fB-t\fR\fR
 400 .ad
 401 .RS 6n
 402 Sorts the listing by last modification time.
 403 .RE
 404 
 405 .sp
 406 .ne 2
 407 .na
 408 \fB\fB-1\fR\fR
 409 .ad
 410 .RS 6n
 411 Produces single column output.
 412 .RE
 413 
 414 .RE
 415 
 416 .sp
 417 .ne 2
 418 .na
 419 \fB\fBlumask\fR \fIumask\fR\fR
 420 .ad
 421 .sp .6
 422 .RS 4n
 423 Sets local \fBumask\fR to \fIumask\fR.
 424 .RE
 425 
 426 .sp
 427 .ne 2
 428 .na
 429 \fB\fBmkdir\fR \fIpath\fR\fR
 430 .ad
 431 .sp .6
 432 .RS 4n
 433 Creates remote directory specified by \fIpath\fR.
 434 .RE
 435 
 436 .sp
 437 .ne 2
 438 .na
 439 \fB\fBput\fR [\fIflags\fR] \fIlocal-path\fR [\fIlocal-path\fR]\fR
 440 .ad
 441 .sp .6
 442 .RS 4n
 443 Uploads \fIlocal-path\fR and stores it on the remote machine. If the remote
 444 path name is not specified, it is specified the same name it has on the local
 445 machine. If the \fB-P\fR flag is specified, then the file's full permission and
 446 access time are copied too.
 447 .RE
 448 
 449 .sp
 450 .ne 2
 451 .na
 452 \fB\fBpwd\fR\fR
 453 .ad
 454 .sp .6
 455 .RS 4n
 456 Displays remote working directory.
 457 .RE
 458 
 459 .sp
 460 .ne 2
 461 .na
 462 \fB\fBquit\fR\fR
 463 .ad
 464 .sp .6
 465 .RS 4n
 466 Quits \fBsftp\fR.
 467 .RE
 468 
 469 .sp
 470 .ne 2
 471 .na
 472 \fB\fBrename\fR \fIoldpath newpath\fR\fR
 473 .ad
 474 .sp .6
 475 .RS 4n
 476 Renames remote file from \fIoldpath\fR to \fInewpath\fR.
 477 .RE
 478 
 479 .sp
 480 .ne 2
 481 .na
 482 \fB\fBrm\fR \fIpath\fR\fR
 483 .ad
 484 .sp .6
 485 .RS 4n
 486 Deletes remote file specified by \fIpath\fR.
 487 .RE
 488 
 489 .sp
 490 .ne 2
 491 .na
 492 \fB\fBrmdir\fR \fIpath\fR\fR
 493 .ad
 494 .sp .6
 495 .RS 4n
 496 Removes remote directory specified by \fIpath\fR.
 497 .RE
 498 
 499 .sp
 500 .ne 2
 501 .na
 502 \fB\fBsymlink\fR \fIoldpath\fR \fInewpath\fR\fR
 503 .ad
 504 .sp .6
 505 .RS 4n
 506 Creates a symbolic link from \fIoldpath\fR to \fInewpath\fR.
 507 .RE
 508 
 509 .sp
 510 .ne 2
 511 .na
 512 \fB\fBversion\fR\fR
 513 .ad
 514 .sp .6
 515 .RS 4n
 516 Displays the \fBsftp\fR protocol version.
 517 .RE
 518 
 519 .sp
 520 .ne 2
 521 .na
 522 \fB\fB#\fR [\fIcomment\fR]\fR
 523 .ad
 524 .sp .6
 525 .RS 4n
 526 Include a comment. This is useful in batch files.
 527 .RE
 528 
 529 .sp
 530 .ne 2
 531 .na
 532 \fB\fB!\fR [\fIcommand\fR]\fR
 533 .ad
 534 .sp .6
 535 .RS 4n
 536 If \fIcommand\fR is not specified, escapes to the local shell.
 537 .sp
 538 If \fIcommand\fR is specified, executes \fIcommand\fR in the local shell.
 539 .RE
 540 
 541 .sp
 542 .ne 2
 543 .na
 544 \fB\fB?\fR\fR
 545 .ad
 546 .sp .6
 547 .RS 4n
 548 Displays help text.
 549 .sp
 550 Identical to the \fBhelp\fR command.
 551 .RE
 552 
 553 .SH EXIT STATUS
 554 .LP
 555 The following exit values are returned:
 556 .sp
 557 .ne 2
 558 .na
 559 \fB\fB0\fR\fR
 560 .ad
 561 .RS 6n
 562 Successful completion.
 563 .RE
 564 
 565 .sp
 566 .ne 2
 567 .na
 568 \fB\fB>0\fR\fR
 569 .ad
 570 .RS 6n
 571 An error occurred.
 572 .RE
 573 
 574 .SH ATTRIBUTES
 575 .LP
 576 See \fBattributes\fR(5) for descriptions of the following attributes:
 577 .sp
 578 
 579 .sp
 580 .TS
 581 box;
 582 c | c
 583 l | l .
 584 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 585 _
 586 Interface Stability     Committed
 587 .TE
 588 
 589 .SH SEE ALSO
 590 .LP
 591 \fBftp\fR(1), \fBscp\fR(1), \fBssh\fR(1), \fBssh-add\fR(1),
 592 \fBssh-keygen\fR(1), \fBsshd\fR(1M), \fBattributes\fR(5)