How to copy a file from a remote server to a linux/windows host

From Linux with scp:
copy a file from a remote machine to the current directory of the current machine:

sudo scp -p port_number user_name@ip_address:file_path .

For example, i wanted to copy the /etc/ssl/exportcerts/John_Doe_windows_cert.der file from a remote linux server vm3 ( to the current directory and my username was duck.
The server accepted ssh, so i used port 22.
The command was:

sudo scp -p 22 duck@ .

Dont miss the dot at the end.

If you want to copy it to a specific directory, replace the last dot with the directory path.

sudo scp -p 22 duck@ /etc/ssl/certificates


From Windows with WinSCP:
Just download WinSCP and connect to your server with it to get your files.

WinSCP Interface

Caution: If you try to copy the file in a directory where you need admin privilege to copy (e.g. system32 or program files), it won’t work from WinScp. I made the same mistake first, and it took me an hour to figure it out. Just copy it to your windows desktop via WinScp and the manually copy it to your desired directory.

Good thing is, WinSCP is a SFTP, SCP and FTP client for windows, so i wont need FileZilla anymore.

For my case, it wasn’t all. I needed to copy the file to my laptop. The was a linux host named vm3 and vm3 was accessible only from another multihomed linux host named vm1, which had two ip addresses, or
When i generated the file on vm3, i was using putty from my windows 7 laptop to connect via ssh to vm1 ( first, then ssh again to vm3 ( With the aforementioned method, i managed to copy the file to vm1 ( or But still, i needed to get it to my windows 7 laptop from vm1 ( and i am still not sure if it is possible to get files from a remote server via putty.

So, i used Winscp to connect to vm1 ( via ssh and copy the file to my windows 7 laptop with just simple drag and drop operation. Why not WinSCP at the first place then? Because, first i needed to login to vm1, then to vm3. and i couldn’t find a way do that kind of inception like operation with WinSCP.


2 responses to “How to copy a file from a remote server to a linux/windows host

  1. I thought I knew a lot there is to know about this thing, but seems we are never to old to learn..;)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s