BreadCrumbs: Secure Copy (SCP)

Secure Copy (SCP)

From Luke Jackson

Jump to: navigation, search



Secure Copy is the quickest, most effect way to transfer data from one machine to another. It's speeds surpass that of SFTP by far, but still are encyrpted with a rock solid algorithm. It may seem a little tricky at first, but it can prove to be quite useful, especially if you can utilize bash scripting.



Secure Copy comes standard and can be executed by the command below:


Mac OS X

Secure Copy comes standard and can be executed by the command below:


Mac OS X (GUI)

There is no built-in Graphical User Interface (GUI) client for scp on Mac OS X.


  • Mac OS X
  • Fugu GUI SCP Client - Download

Install Fugu

Fugu Screenshot
Fugu Screenshot

Installing .DMG Applications on Mac OS X is very simple. Simply drag the icon from the .DMG image window into your Applications folder and you are done.


Once you have installed Fugu simply enter the information into the fields provided.

  • Connect: Server Address
  • User Name: Login ID
  • Port: SCP port number (Default port 22)
  • Directory: Starting directory (Optional)

After you click connect Fugu will attempt to authenticate with the server based on the servers installed mechanisms. This simply means that if you are not using Public Key Authentication it will fall back to password authentication and prompt you for your password.

Windows XP

While not native to Windows, there is a Windows program that acts the same called pscp, which is created by the same people who distribute PuTTY - "".

To install on Windows, download and save pscp.exe to C:\WINDOWS\. This way you can type pscp in any folder and still have access to it. If you are using pscp, please remember throughout this guide to replace scp with pscp!

Some drawbacks to the windows version of pscp:

  • Does not support files over 2GB. It doesn't tell you, either, it just corrupts the file.
  • Does not transfer as quickly as scp.
  • Does not support spaces of any type in file names (quotations won't save you this time!)

Windows XP (GUI)

WinSCP Screenshot
WinSCP Screenshot

There is no built-in Graphical User Interface (GUI) client for scp on Windows XP.


Install WinSCP

Once the executable is finished downloading simple follow the dialog boxes to install the software on your computer.


Once you have installed WinSCP simply enter the information into the fields provided.

  • Host name: Server Address
  • Port: SCP port number (Default port 22)
  • User Name: Login ID
  • Password: Password
  • Private key file: Path to your private key (Optional)
  • SFTP, SFTP (SCP Fallback), SCP

Once you click Login WinSCP will authenticate with the server and bring up an window displaying the current files on the server.



To put a file in your home directory on the server:

scp local_file.txt

To send a file to a specific directory:

scp local_file.txt

To put the file on the server in a subfolder of your home dir named "downloads", the command would be:

scp local_file.txt

Notice the difference between the last two. When going to a folder that does not reside within your home dir, you must start with the root directory and give a full path. When you are adding stuff to your home folder, you do NOT start with a root directory! (Root directory is the forward slash to the very left of the path.)

(The following tip does not work from pscp, ONLY scp): If your local username is the same as the remove username, you can omit your login name from the command. For instance, if your local login is jwatt and your remove login is jwatt, you can take this command:

scp local_file.mp3

and simplify it, turning it into:

scp local_file.mp3

This doesn't work on Windows because local Windows users are different than linux users.

To upload a directory to a webserver, you use the recursive switch -r:

scp -r local_folder/

After uploading, the folder location will be:



To download the file "serials.txt" from your remote home dir to the local computer:

scp .

To download the remote file "something" using it's full path to your local computer:

scp .

Now the tricky part: using the recursive switch (-r) to download a whole folder to your local computer. The issue you may have is that you DO NOT place a trailing forward slash after the directory name. For instance, this command will NOT work (notice the bold forward slash):

scp -r .

This will give you a message saying the server is trying to write to the parent directory. REMOVE the last foward slash on the path and try again. The next command is CORRECT:

scp -r .

I have been using a period when talking about downloading so far. Reason: this brings the file into the directory you are currently in. If you wish to take the last command and download it to somewhere else, the command would be:

scp -r /new/local/location/

Escaping Spaces with (~) Tilda Support

Below is an example of how to work with spaces in directory structure:

scp user@server.ext:'/home/samba/Service\ Deliver/System\ Admin/file\ name.sxw' .
scp user@host:"'filename with spaces'" destination

rsync --bwlimit=2048 --partial --progress -vvrae 'ssh' user@server:~/"'files/Name - With A lot Of spaces'" .

Public Key Authentication

If you have many different servers that you have to connect to on a daily basis it may be more effective for you to use Public Key Authentication. With this feature enabled you are able to securely authenticate to servers with out typing in a password. Unfortunately in order to use it you will have to configure you server and client to support it.

See Also

External Links

Personal tools