Home Tips and Instructions Linux & UNIX Using SSH to FTP / SFTP from One Remote Server To Another
Using SSH to FTP / SFTP from One Remote Server To Another PDF Print E-mail
This technique allows you to move files from one web FTP / SFTP server to another without having to download any files locally. This can be extremely useful when switching web hosting companies (provided that your new service provides ssh access!).

Requirements:

  • You have ssh access on the server you wish to download/move files to.
  • You have some familiarity with navigating directories and viewing the files inside of them from the Linux/Unix command line.

1. First you need to establish and ssh connection to the server/computer from which you wish to initiate FTP

2. To do this at a command prompt type ssh followed by your username @ the domain name or IP address (same line) and press enter. See the two examples below.

ssh username@domainname 

OR

ssh This e-mail address is being protected from spambots. You need JavaScript enabled to view it  

3a. Establising an FTP Connection

Then you are ready to establish the FTP connection to the other remote server. To do this at the command prompt type ftp followed by the domain name or IP address. See the two examples below:

ftp domainname

OR

ftp 123.456.789.10 

3b. Establishing an SFTP Connection

Then you are ready to establish the SFTP connection to the other remote server. To do this at the command prompt type ftp followed by the domain name or IP address. See the two examples below:

sftp domainname

OR

sftp 123.456.789.10

4. You should then be prompted for your username on this remote server. Type your username and press Enter.

5. You should then be prompted for your password Type your password and press Enter.

6. Then type get followed by the location of the file which should be followed by the location you wish to download the file to. (all on the same line) See the example below.

(To fetch a file file named backup.tar.gz and download it to /home/your_account/public_html

You would type:

get backup.tar.gz /home/your_account/public_html

TIPS: Use cd to navigate to the directory you want to retrieve the file from and ls to list the files in that directory.

7. When you are finished you type quit and the command prompt and this will quit your FTP / SFTP session.

8. You should then type exit to quit your ssh session.

8. Then you can quit your command line session and you are finished! (Type exit if you are using a terminal.)