How to use scp to download files from a remote machine over a secure encrypted connection.

Posted: August 24, 2014. At: 2:57 PM. This was 4 years ago. Post ID: 7650
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This is the sample command I am using to download my OpenVPN keys from a remote VPN server to allow me to setup a local connection. And to backup the keys safely.

[1]homer@deusexmachina ~ $ scp -i Goku.pem -P 443 ubuntu@192.168.100.75:/home/ubuntu/easy-rsa/keys/*.* /home/homer/vpn/
01.pem                                                                                                                   100% 5589     5.5KB/s   00:00
ca.crt                                                                                                                   100% 1736     1.7KB/s   00:00
ca.key                                                                                                                   100% 1704     1.7KB/s   00:00
dh2048.pem                                                                                                               100%  424     0.4KB/s   00:01
gmail.crt                                                                                                                100% 5589     5.5KB/s   00:00
gmail.csr                                                                                                                100% 1110     1.1KB/s   00:00
gmail.key                                                                                                                100% 1704     1.7KB/s   00:01
index.txt                                                                                                                100%  132     0.1KB/s   00:00
index.txt.attr                                                                                                           100%   21     0.0KB/s   00:00
index.txt.old                                                                                                            100%    0     0.0KB/s   00:00
serial.old                                                                                                               100%    3     0.0KB/s   00:00

Very useful when you do not have direct access to a machine.

You may also use sftp to connect to a remote machine.

[1]homer@deusexmachina ~ $ sftp -i Goku.pem -P 443 ubuntu@192.168.100.75
Connected to 192.168.100.75.
sftp>

Then you may list the contents of the remote home directory.

sftp> dir
asterisk-12-current.tar.gz            asterisk-12.4.0                       dahdi-linux-complete-2.10.0+2.10.0    dahdi-linux-complete-current.tar.gz
easy-rsa                              freepbx                               iksemel-1.4                           iksemel-1.4.tar.gz
jansson                               libpri-1.4-current.tar.gz             pjproject

And download this to the local machine.

sftp> get iksemel-1.4.tar.gz
Fetching /home/ubuntu/iksemel-1.4.tar.gz to iksemel-1.4.tar.gz
/home/ubuntu/iksemel-1.4.tar.gz                                                                                          100%  503KB 503.5KB/s   00:01

No comments have been made. Use this form to start the conversation :)

Leave a Reply