Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

SFTP

News SSH Recommended Links Private and Public key management Reference WinSCP
ssh-keygen man page SSH Usage in Pipes SCP Tips humor Etc

SFTP is normally used as an intractive application/protocol, but also can be put into a batch mode with the -b flag. This can be specified with a file or can be directed stdin from an external script.

The password can not be passed by either process.

sftp [-1Cv] [-b batchfile] [-F SSH_config] [-o SSH_option] [-s subsystem | sftp_server] [-S program] host

sftp [[user@]host[:file [file]]]

sftp [[user@]host[:dir[/]]]

But mostly SFTP is used as an interactive file transfer program.

With FTP one might try to copy up all their JPG files to their image directory like this:

ftp> cd /home/user/images/
ftp> bin
ftp> prompt
ftp> mput *.jpg

With SFTP it is much simpler..

sftp> cd /home/user/images/
sftp> put *.jpgtt>

List of SFTP commands (SFTP will abort if any of the following commands fail):

List of other commands:

SFTP may also use many features of SSH, such as public key authentication and compression. SFTP connects and logs into the specified host, then enters an interactive command mode. The second usage format will retrieve files automatically if a noninteractive authentication method is used; otherwise it will do so after successful interactive authentication. The last usage format allows the sftp client to start in a remote directory. 

Here are the options used:


Notes:
  • This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • The site contain some broken links as it develops like a living tree... Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.
Google Search
Open directory

Research Index

Old News ;-)

[Mar 16, 2010] Resuming interrupted sftp transfers in Linux « Free Software

Even though the Linux version of the sftp client doesn’t offer a direct way to resume an interrupted transfer, doing so is quite simple by using common shell tools, as long as you are able to login to the remote server through a console. Assuming that you are transferring data.zip from source_server to target_server and the transfer was interrupted, you can do the following:

This works for both text and binary files. Apparently a better way would be integrating this ability into the sftp client, which is the way some clients such as putty and winscp work, but until that happy day you can use the tips above as a workaround.

Comments

mikeX:

lftp is a very nice command line ftp client, which supports tab completion, directory mirroring and of course resuming of interrupted downloads. It can also work as an sftp client, with the right protocol prefix, e.g. lftp sftp://user@host, and can even be used in batch mode. You can find a copy at http://lftp.yar.ru/. Still, nice trick :)

 



Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: March 16, 2010