Questions tagged [scp]

Secure Copy or SCP is a means of securely transferring computer files between a local and a remote host or between two remote hosts.

SCP uses encryption based on the Secure Shell (SSH) protocol to securely transfer files between hosts. It is available in most Unix distributions via the scp command.

769 questions
505
votes
6 answers

How to copy a file from a remote server to a local machine?

In my terminal shell, I ssh'ed into a remote server, and I cd to the directory I want. Now in this directory, there is a file called table that I want to copy to my local machine /home/me/Desktop. How can I do this? I tried scp table…
omega
  • 5,537
  • 5
  • 18
  • 14
255
votes
9 answers

scp without replacing existing files in the destination

How do I copy an entire directory into a directory of the same name without replacing the content in the destination directory? (instead, I would like to add to the contents of the destination folder)
biznez
231
votes
5 answers

How to use wildcards (*) when copying with scp?

Why can't I copy with scp when I'm using * characters in the path? scp SERVERNAME:/DIR/* . What configuration does SCP need in order to allow * in the path? UPDATE: the problem is not on server side; pscp is trying to use SCPv1, and that's why the…
LanceBaynes
  • 39,295
  • 97
  • 250
  • 349
177
votes
5 answers

How to copy all files from a directory to a remote directory using scp?

My goal is copy only all files from ~/local_dir to [email protected] /var/www/html/target_dir using scp and do not create local_dir category in local_dir. /var/www/html/target_dir/files.. but not /var/www/html/target_dir/local_dir/files.. when use -r…
Edgaras Karka
  • 2,447
  • 5
  • 15
  • 14
170
votes
8 answers

Can scp create a directory if it doesn't exist?

I want to use scp to upload files but sometimes the target directory may not exist. Is it possible to create the folder automatically? If so, how? If not, what alternative way can I try?
AGamePlayer
  • 7,415
  • 16
  • 46
  • 55
159
votes
8 answers

Use scp to transfer a file from local directory X to remote directory Y

I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong. I'm using Linux Mint and I'm trying to figure out how scp works. I've a file file.ext (on my computer) in directory…
dragonmnl
  • 2,169
  • 3
  • 19
  • 26
143
votes
7 answers

Error using SCP: "not a regular file"

I have been searching for a while and I can't find the definition of a regular file. My path is permanent (I start at /) and I am connecting to scp root@IP: /path/to/picture.jpg Results in an inquiry for a password and then... scp: .: not a regular…
JeffM
  • 1,533
  • 2
  • 10
  • 6
137
votes
10 answers

How to get scp to copy the file instead of its symlink

I want to scp a file to a server. The file is a symbolic link, and actually what I want to do is copy the source file. I don't want to track the source file's path manually, because it can be replaced. How do I get the source file's absolute path so…
Eonil
  • 4,607
  • 11
  • 30
  • 30
114
votes
8 answers

Why is scp so slow and how to make it faster?

I'm trying to copy a batch of files with scp but it is very slow. This is an example with 10 files: $ time scp cap_* user@host:~/dir cap_20151023T113018_704979707.png 100% 413KB 413.2KB/s 00:00 cap_20151023T113019_999990226.png 100% …
laurent
  • 1,868
  • 3
  • 17
  • 22
100
votes
4 answers

What's the difference between SFTP, SCP and FISH protocols?

I used to think SCP is a tool to copy files over SSH, and copying files over SSH is called SFTP, which is itself a synonym to FISH. But now as I was looking for a Total Commander plugin to do this in Windows, I've noticed that on its page it says…
Ivan
  • 17,368
  • 35
  • 93
  • 118
95
votes
16 answers

Transfer files using scp: permission denied

I try to transfer files from remote computer using ssh to my computer : scp My_file.txt user_id@server:/Home This should put My_file.txt in the home folder on my own computer, right? I get scp/Home: permission denied Also when I try:…
Erez
  • 961
  • 1
  • 6
  • 4
89
votes
3 answers

scp and compress at the same time, no intermediate save

What is the canonical way to: scp a file to a remote location compress the file in transit (tar or not, single file or whole folder, 7za or something else even more efficient) do the above without saving intermediate files I am familiar with shell…
Robottinosino
  • 5,271
  • 12
  • 39
  • 51
88
votes
10 answers

Autocomplete server names for SSH and SCP

I have a few servers configured in ~/.ssh/config, such as alpha and beta. How might I configure Bash such that the commands $ ssh alTab and $ scp file.tgz alTab autocomplete the names of the configured servers? I don't want to add the servers to…
dotancohen
  • 15,494
  • 26
  • 80
  • 116
88
votes
13 answers

How can I best copy large numbers of small files over scp?

I have a directory that's got several gigabytes and several thousand small files. I want to copy it over the network with scp more than once. CPU time on the source and destination machines is cheap, but the network overhead added by copying each…
nmichaels
  • 980
  • 1
  • 7
  • 8
77
votes
6 answers

Is there ever a reason to use scp instead of rsync?

Is there a reason to use scp instead of rsync? I can see no reason for using scp ever again, rsync does everything that scp does, with more safety (can preserve symlinks etc).
mikebloch
  • 889
  • 1
  • 6
  • 5
1
2 3
51 52