Wednesday, June 18, 2008

Using sftp to transfer file through network

There are a lot of ways on how to transfer files through network in linux and open source. One of the solution is to use sftp a.k.a. secure file transfer protocol. The reason this sftp is different from the original ftp is, sftp will do all its operation over encrypted ssh transport. This make sure that your file is safely transferred through network. To use sftp, you can just run command
$ sftp user@servername
For example,
$ sftp foo@server.name or
$ sftp foo@192.168.0.1

To use sftp efficiently, a few important commands one need to know, as listed below:

  1. To get help on commands available.
    • sftp> help
    • sftp> ?
  2. The commands are generally divided into 2 groups: the commands that can be used to manipulate localhost and the commands that can be used to manipulate remote host. The commands that start with 'l' are specially for locahost only. Example, to list all directory listing on localhost:
    • sftp> lls
  3. To list directories on remote host, use:
    • sftp> ls
  4. The most important command, how to upload file to the remotehost
    • sftp> put /local/path /remote/path
  5. To download file from remotehost
    • sftp> get /remote/path /local/path
To get more information, use the first step to generate help page where list of commands and how to use it are shown.

No comments: