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.

Filter by
Sorted by
Tagged with
514 votes
6 answers
2.3m views

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. ...
omega's user avatar
  • 5,637
256 votes
9 answers
364k views

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)
user avatar
235 votes
5 answers
256k views

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 ...
LanceBaynes's user avatar
  • 39.7k
180 votes
5 answers
514k views

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 /...
Edgaras Karka's user avatar
171 votes
8 answers
278k views

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's user avatar
  • 7,505
164 votes
8 answers
849k views

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'...
dragonmnl's user avatar
  • 2,219
145 votes
7 answers
537k views

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 ...
JeffM's user avatar
  • 1,552
137 votes
10 answers
258k views

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....
Eonil's user avatar
  • 4,627
117 votes
8 answers
252k views

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 ...
laurent's user avatar
  • 1,908
100 votes
4 answers
109k views

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 ...
Ivan's user avatar
  • 17.5k
96 votes
16 answers
556k views

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/...
Erez's user avatar
  • 971
90 votes
11 answers
90k views

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 ...
dotancohen's user avatar
  • 15.7k
89 votes
3 answers
181k views

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 ...
Robottinosino's user avatar
88 votes
13 answers
102k views

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, ...
nmichaels's user avatar
  • 980
77 votes
6 answers
98k views

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's user avatar
  • 889
66 votes
6 answers
13k views

Is scp unsafe? Should it be replaced with sftp?

I have over 20 years experience in Un*x, and I have been using scp for immemorial times. scpis over SSH, therefore I consider it as secure as the latter. Now, in my company, where I recently took up a ...
Fabien Haddadi's user avatar
61 votes
5 answers
56k views

SCP fails without error

I've been experiencing very strange behavior of SCP for some time: whenever I try to copy a file, the output of SCP contains a bunch of underscores and the file is not copied. $ scp test.txt 192.168....
mtvec's user avatar
  • 2,728
59 votes
3 answers
62k views

What does the `-C` flag exactly do in `scp`?

I always use either rsync or scp in order to copy files from/to a remote machine. Recently, I discovered in the manual of scp (man scp) the flag -C -C Compression enable. Passes the -C flag to ...
Remi.b's user avatar
  • 1,125
51 votes
7 answers
243k views

Scp from one server to another server?

I am trying to copy files from one server directly to another, bypassing my local computer. I did scp -r [email protected]:~/data/* [email protected]:~/data/ Password: Host key verification ...
Sibbs Gambling's user avatar
50 votes
3 answers
30k views

scp wildcard not working in zsh

I have switched over to zsh, and it is working fine. One strange thing, when I try to scp with a * wildcard, it does not work, and I have to drop into bash. The second command below works fine. Any ...
port5432's user avatar
  • 941
48 votes
3 answers
107k views

How to copy only new files using "scp" command?

I was copying hundreds of files to another computer using the scp command that I got the stalled error. Now I am going to copy the files again. Is there any way to avoid copying the already copied ...
B Faley's user avatar
  • 4,253
42 votes
5 answers
173k views

How to pull a file from a server using scp?

I am on machine A and want to pull a file from machine B. A$ scp <myuserid>@hostB:<path of file in B> . it says that: scp: <path of file in B>: No such file or directory But on ...
xyz's user avatar
  • 2,961
42 votes
2 answers
29k views

Do you need a shell for SCP?

I'm allowing a friend a local account on my machine, exclusively for SCP. Can I specify his account's shell as /bin/true, or in any other way limit the account, while still allowing SCP?
user avatar
41 votes
3 answers
86k views

Restricting an SSH/SCP/SFTP user to a directory

Is there a simple way to restrict an SCP/SFTP user to a directory? All methods that I've come across require me to set a chroot jail up by copying binaries, but I don't think that should be necessary.
user avatar
39 votes
7 answers
222k views

Sending files over Samba with command line

I was wondering if there is a way to use Samba to send items to a client machine via the command line (I need to send the files from the Samba server). I know I could always use scp but first I was ...
t0xic's user avatar
  • 495
38 votes
4 answers
39k views

How to pipe a remote file to stdout over scp or sftp?

Using ssh, it is easy to print the contents of a file using ssh host 'cat file.txt' When ssh is disabled, and only SFTP is enabled, running the previous command gives the following error: This ...
Rob W's user avatar
  • 908
37 votes
5 answers
61k views

Does a `scp` transfer close when I close the shell?

I have scp transfer (from one remote server to another), that is quite big. So maybe I want close the computer from which I executed this command, will this end the transfer? I have ssh access to ...
Borut Flis's user avatar
34 votes
3 answers
90k views

Transferring large (8 GB) files over ssh

I tried it with SCP, but it says "Negative file size". >scp matlab.iso xxx@xxx:/matlab.iso matlab.iso: Negative file size Also tried using SFTP, worked fine until 2 GB of the file had transferred,...
eimrek's user avatar
  • 553
32 votes
8 answers
11k views

How can I download a file from a host I can only SSH to through another host?

I want to download files from my office computer to my laptop. I can connect my office machine by SSH to the organization server and then SSH from the server to my office machine. The only commands ...
Yohai Magan's user avatar
31 votes
2 answers
58k views

Copying files with certain extensions with scp

I want to copy over .jpg and .png files with scp, but there files with different extensions in the same folder I'm copying from. I am doing the following: scp [email protected]:/folder/*.{jpg,...
sodiumnitrate's user avatar
31 votes
2 answers
155k views

sftp command to get/download .tar.gz file

I thought I was familiar with sftp commands in unix and upto my knowledge the command to used to download a compressed file from the server is sftp get filename.tar.gz But when I tried this ...
GIRI's user avatar
  • 877
30 votes
2 answers
19k views

scp command working in bash doesn't work in zsh

This command works fine in bash: bash-3.2$ scp luna4:/u/paige/maye/src/diviner/notebooks/plots/hk_* . hk_az.png 100% 126KB 126.0KB/s 00:00 ...
K.-Michael Aye's user avatar
28 votes
5 answers
51k views

Why does SCP hang on copying files larger than 1405 bytes? [duplicate]

I'm trying to copy a file from one of my local machines to a remote machine. Copying a file with size upto 1405 bytes works fine. When I try to scp a larger file, the file gets copied but the scp ...
Chandranshu's user avatar
28 votes
1 answer
11k views

Transfer a file over a unstable SSH connection

I'm trying to upload some big files (around 10GB) with a slow upload speed (200kb/s) on a often disconnected SSH connection (due to poor network conditions). I'm trying to use scp, but if there is a ...
blue112's user avatar
  • 617
27 votes
4 answers
49k views

How to scp with regular expressions

I'm trying to copy all files that do not begin with the letter "a", in ksh. Copying from the source machine to destination machine is working fine: scp -p !(a*) user@machine:/path/directory/. But, ...
Ryan P's user avatar
  • 381
27 votes
3 answers
25k views

Do I need to check for file corruption once scp is done?

I have recursively transferred many files and folders with scp, using the command: scp -rp /source/folder [email protected]:/destination/folder After the transfer is completed, do I ...
Franck Dernoncourt's user avatar
23 votes
4 answers
31k views

scp from one remote server to another remote server

I have one big file on server one and I want to copy it to server two using scp. I have the keys setup properly and I can ssh/scp to both servers from my desktop. The file I need to copy is larger ...
Jan Spurny's user avatar
22 votes
3 answers
48k views

Copy over ssh and execute commands in one session [duplicate]

Possible Duplicate: Using an already established SSH channel Here is my sync script: ssh [email protected] /etc/init.d/some_service stop scp [email protected]:/var/some_service/events ./events scp ...
Arenim's user avatar
  • 341
22 votes
5 answers
62k views

Changing user while scp

I need to copy file between Linux machines. The problem that the user I use to login (myuser), is different from the user that can access the file. If I just ssh to the machine, I can switch the user ...
Tarlog's user avatar
  • 323
21 votes
1 answer
39k views

How to view progress with sshpass and scp in linux?

In my Linux terminal, I am using this command sshpass -p "pass" scp -r [email protected]:/cmshome/me/file /home/me/Desktop to download a file with a password in it. Without the sshpass, I can see the ...
omega's user avatar
  • 5,637
20 votes
5 answers
44k views

how to find out the ip of an ssh HostName

Is there a simple way to retrieve the IP of a HostName from an ssh config on the command line? Many times I have to use scp and would like to connect to a machine, but I remember only the HostName.
m33lky's user avatar
  • 2,535
19 votes
3 answers
51k views

How do I scp via ssh? [duplicate]

I have a LINUX machine (remote), and a MAC machine (local). Our system administrator set up an "SSH" method, whereby I can ssh from my MAC, to my LINUX machine, via this command on my MAC: ssh marcus@...
TheGrapeBeyond's user avatar
19 votes
5 answers
65k views

SCP from one server to another without password prompt

What is the best way of doing scp from one box to the other without prompting for password? There are two servers: Server A (10.152.2.10): /home/oracle/export/files.txt Server B (10.152.2.11): /home/...
user avatar
18 votes
5 answers
20k views

Suppress server message in rsync

When I rsync or scp from a particular server I get a rather long message telling me the rules of the server. However when I setup regular pulls, I'd like to be able to suppress those messages in my ...
Hooked's user avatar
  • 1,343
17 votes
3 answers
33k views

How can I save password,when using SCP (copy)?

I'm facing problem when I pull a file from another machine to my machine using SCP. File is successfully transferred but each time it asks for password. I want to run this SCP command as a cronjob, ...
Nishat's user avatar
  • 353
17 votes
5 answers
59k views

How to copy with SCP between two servers using key auth?

I can log in via SSH using key authentication to SERVER1 and SERVER2. However, I can't copy files between the two servers. Why? How can I copy between them? (the data that I have to copy is bigger ...
LanceBaynes's user avatar
  • 39.7k
17 votes
2 answers
201k views

cp: cannot stat : No such file or directory

I am getting an error when I try to copy a file from my local computer to a remote server with ssh. I get the same error whether I use cp or scp. Here is my input at the resulting error: [root@xxx....
CodeMed's user avatar
  • 5,149
16 votes
4 answers
19k views

Transferring millions of files from one server to another

I have two servers. One of them has 15 million text files (about 40 GB). I am trying to transfer them to another server. I considered zipping them and transferring the archive, but I realized that ...
yuli chika's user avatar
16 votes
2 answers
11k views

Running scp when .bashrc of remote machine includes source command

I cannot copy a file over scp when the remote machine .bashrc file includes source command to update paths and some variables. Why does it happen?
yildizabdullah's user avatar
16 votes
2 answers
37k views

How to use SFTP in a script to non-interactively pull file from remote host?

I want to use a shell script to pull a file from another server. I have written a script where i can do this but i want the script to work non-interactively so that it doesn't prompt me for the ...
Ankit Vashistha's user avatar

1
2 3 4 5
16