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
515 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,647
41 votes
3 answers
87k 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
2 votes
1 answer
4k views

SCP through multiple hosts

The question describes how to SSH into a machine that can only be accessed through one or more hosts (that can also be SSH'd into). Is there an equivalent way of using scp? That is, copy a file to my ...
tonysdg's user avatar
  • 123
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
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
258 votes
9 answers
365k 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
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
91 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
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
5 votes
4 answers
15k views

Disable direct login for normal users but allow scp and sftp?

Is it possible to disable direct login for normal users (like oracle) in Linux but allow scp and sftp for that use?
Arvind Kumar's user avatar
4 votes
4 answers
4k views

How to execute multiple commands remotely on few servers?

I am trying to automate these steps so that I don't need to do this on every machines manually. I need to install latest app server software (abc.tar.gz) on all the unix boxes. I need to do this in ...
user1950349's user avatar
3 votes
2 answers
4k views

Move file to another user's home directory (without sudo)?

I have a couple of files that I want to move to another's user home directory. I don't have permissions to write to that user's home directory, but I know his password. I know how to copy the file ...
a06e's user avatar
  • 1,687
6 votes
3 answers
10k views

Transferring Files SSH SCP Error Message: 'Stdin: is not a tty'

I am using a Macbook SSH terminal and generated RSA key pairs and uploaded remote id_rsa.pub with approved permissions. I can connect with remote Apache web server. I can create, open, move, modify ...
user2217265's user avatar
164 votes
8 answers
853k 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
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
14 votes
3 answers
30k views

How do I copy a file with scp with special characters?

I am trying to copy a file that has colons and periods, e.g., with: scp "test.json-2014-08-07T11:17:58.662378" remote:tmp/ scp test.json-2014-08-07T11\:17\:58.662378 remote:tmp/ and combinations ...
Finn Årup Nielsen's user avatar
9 votes
3 answers
10k views

Problem in secure copying (scp) filenames with spaces

I am trying to copy files using secure copy(scp). I am trying to execute the following command but I get error due to the space in the absolute path of the location of the directory. scp -r -P 8484 ...
pradeepchhetri's user avatar
7 votes
2 answers
5k views

why rsync does not do delta transfer

I have binary file which has approx 77MB: nupic@nupic-virtualbox:~/VboxSharedFolder/experiments/sync/exp2$ ls -lah src/ total 77M drwxrwx--- 1 root vboxsf 0 Jun 21 13:31 . drwxrwx--- 1 root vboxsf ...
Wakan Tanka's user avatar
1 vote
2 answers
1k views

not able to execute multiple commands on multiple linux machines?

I have around 50 ubuntu machines on which I need to run below commands: sudo apt-get install htop sudo scp -r [email protected]:/home/todd/pip /tmp/ sudo apt-get install python-pip sudo pip ...
david's user avatar
  • 2,157
181 votes
5 answers
517k 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
118 votes
8 answers
253k 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,918
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
59 votes
3 answers
63k 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
39 votes
7 answers
223k 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
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
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
10 votes
2 answers
14k views

Provide parameters to scp with xargs

When I run svn st | awk '{print $2}', I get: a.py b.py c.py Then I want to scp these files to a remote server. I have tried: svn st | awk '{print $2}' | xargs scp my_name@my_server:~/ But it doesn'...
mitnk's user avatar
  • 551
7 votes
1 answer
15k views

How to scp through two intermediate servers to a third-hop server [duplicate]

I have seen plenty of examples for scp through an intermediate server to a second-hop server via ProxyCommand operator such that: A:/infile.txt -> B -> C:/outfile.txt Which looks something ...
SYANiDE's user avatar
  • 507
5 votes
2 answers
14k views

How can I send single file to multiple remote sites at the same time?

Can scp be used to send a single file to multiple remote servers at the same time? If so, how? If not, what's the alternative?
N. F.'s user avatar
  • 2,149
4 votes
3 answers
32k views

host key verification failed when I use scp

When I use scp between the VM1 and VM2 , there is no problem, because of other reason I removed the VM2, and rebuild it by VMware workstation, when I use the scp to copy the file from the VM1 to the ...
three-blocks's user avatar
4 votes
3 answers
9k views

Copy files from remote server to local, ignoring existing files (rsync not available)

I would like to copy a directory of files from a remote server to my local machine. As it is a large number of files, the option of ignoring existing files is desirable. Unfortunately, rsync is not ...
jasonmcclurg's user avatar
3 votes
1 answer
556 views

Unrar local files to remote server

I have two Linux servers, one which has several RAR files and another empty one. I would like to extract the archives and move the content to Server 2. The problem is: I do not have enough storage to ...
Force's user avatar
  • 131
2 votes
1 answer
2k views

How to transfer a part of a file from remote system via SCP?

I am trying to fetch a log file which is repeatedly updated. I want that updated file, but don't want to download the entire file again and again from the remote system via SCP. Any idea to achieve ...
Akhil Gangula's user avatar
2 votes
1 answer
5k views

File transfer through jump host

I need to move files to destination server(s) to which we have to pass-through 2 jump servers. Currently this is how my alias are setup alias tst = 'ssh -A -t xjmp01 ssh -A -t xjmp02 ssh -A -t qat1' ...
gvphubli.blogspot.com's user avatar
2 votes
2 answers
3k views

Syntax to transfer from remote to local scp by leapfrogging onto another host?

I am trying to copy files from a remote server to my local server, however, my remote server first requires me to connect to an intermediate host and then leapfrog onto the actual server from there. I ...
skidjoe's user avatar
  • 121
2 votes
1 answer
2k views

upload and dowload the files from server without giving password

I want to download the file from sever by using cron job, so I need to use scp command without giving password by keyword. How do I do so?
Mukesh's user avatar
  • 23
1 vote
1 answer
2k views

SCP reproducably breaks SSH pipe [duplicate]

I'm trying to copy some certificates onto my server using scp. $ scp ./cert.* [email protected]:/tmp/ cert.crt 100% 2386 0.1KB/s 00:18 packet_write_wait: Connection to 192.168.0.42 port ...
SaAtomic's user avatar
  • 205
1 vote
4 answers
7k views

Downloading file through SSH with a "proxy" machine inbetween

I need to download a file from machine C to machine A. To do that, I need to login to machine B (I am doing this using scp), as I cannot access C directly from A. Would it be possible to download a ...
syntagma's user avatar
  • 12.2k
1 vote
2 answers
2k views

Shell Script - how to scp into remote server and download files and protect password

I have a remote server that I need to download Apache logs from. I can manually scp into the server and get the files, but I'd like to put this in crontab. The only way to automate it is to include ...
Tensigh's user avatar
  • 341
146 votes
7 answers
539k 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,562
96 votes
16 answers
559k 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
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
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
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
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
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
2 answers
202k 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
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