Questions tagged [scp]

For questions around "Secure Copy Protocol" (SCP). GENERAL SCP SUPPORT IS OFF-TOPIC. Support questions may be asked on https://superuser.com. Secure Copy Protocol or SCP is a means of securely transferring computer files between a local and a remote host or between two remote hosts over an SSH protocol. This tag is NOT related to "SAP Cloud Platform"!

Secure Copy or SCP is a means of securely transferring computer files between a local and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol.

The term SCP can refer to one of two related things, the SCP protocol or the OpenSSH scp program.

Source: Wikipedia (Secure copy)

1861 questions
131
votes
16 answers

scp from Linux to Windows

I am running a putty client on a Windows machine to connect successfully to a Linux box. Now I want to be able to copy a file from the Linux machine under the path /home/ubuntu/myfile to C:/Users/Anshul/Desktop on my local computer. The user at the…
user1344963
  • 1,319
  • 2
  • 9
  • 4
121
votes
13 answers

Transfer files to/from session I'm logged in with PuTTY

I'm logged into a remote host using PuTTY. What is the command to transfer files from my local machine to the machine I'm logged into on PuTTY?
blue-sky
  • 51,962
  • 152
  • 427
  • 752
118
votes
7 answers

Single line sftp from terminal

Several times throughout the day, I may be running a test where I need to look through a log file on a remote server. I've gotten used to using my terminal to sftp into the remote server and pull the desired log file down to /tmp on my local…
Kyle
  • 14,036
  • 11
  • 46
  • 61
115
votes
9 answers

How to filter files when using scp to copy dir recursively?

I need to copy all the .class files from server to local with all dir reserved. e.g. server:/usr/some/unknown/number/of/sub/folders/me.class will be /usr/project/backup/some/unknown/number/of/sub/folders/me.class the problem is, there are many other…
derrdji
  • 12,661
  • 21
  • 68
  • 78
104
votes
6 answers

recursively use scp but excluding some folders

Assume there are some folders with these…
mahmood
  • 23,197
  • 49
  • 147
  • 242
102
votes
7 answers

Copying a local file from Windows to a remote server using scp

I try to transfer a folder of files from my local computer to a server via ssh and scp. After getting sudo privileges, I'm using the command as follows: scp -r C:/desktop/myfolder/deployments/ user@host:/path/to/whereyouwant/thefile However, I get…
HelloWorld
  • 4,251
  • 8
  • 36
  • 60
97
votes
4 answers

SSH SCP Local file to Remote in Terminal Mac Os X

I am attempting to copy a local file 'magento.tar.gz' from my local machine to a remote server using SSH through a VPN. This is connecting to the Virtual Machine's Internal IP which I've used as xx.x.x.xx here. I have full 'sudo' access on the SSH…
James
  • 3,233
  • 3
  • 40
  • 57
96
votes
7 answers

How to scp with a second remote host

I wonder if there is a way for me to SCP the file from remote2 host directly from my local machine by going through a remote1 host. The networks only allow connections to remote2 host from remote1 host. Also, neither remote1 host nor remote2 host…
Danosaure
  • 3,578
  • 4
  • 26
  • 41
96
votes
14 answers

Automate scp file transfer using a shell script

I have some n number of files in a directory on my unix system. Is there a way to write a shellscript that will transfer all those files via scp to a specified remote system. I'll specify the password within the script, so that I don't have to enter…
jimko
88
votes
5 answers

Is it possible to make SCP ignore symbolic links during copy?

I need to reinstall one of ours servers, and as a precaution, I want to move /home, /etc, /opt, and /Services to backup server. However, I have a problem: because of plenty of symbolic links a lot of files are copied multiple times. Is it possible…
Kris_R
  • 2,738
  • 3
  • 20
  • 21
87
votes
10 answers

SCP doesn't work when echo in .bashrc?

I have two users in Fedora: Wani root (quite obvious!) My contents of .bashrc of user Wani are: # .bashrc echo "Hello" # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions Now after…
Nehal J Wani
  • 16,071
  • 3
  • 64
  • 89
86
votes
9 answers

How to download a file from my server using SSH (using PuTTY on Windows)

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server. (Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal…
SobieSki
  • 899
  • 1
  • 6
  • 5
86
votes
15 answers

scp transfer via java

What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer.
Lloyd Meinholz
  • 2,580
  • 1
  • 22
  • 20
83
votes
6 answers

Why is copying a directory with Ansible so slow?

I'm using Ansible to copy a directory (900 files, 136MBytes) from one host to another: --- - name: copy a directory copy: src={{some_directory}} dest={{remote_directory}} This operation takes an incredible 17 minutes, while a simple scp -r…
dokaspar
  • 8,186
  • 14
  • 70
  • 98
83
votes
5 answers

SCP Permission denied (publickey). on EC2 only when using -r flag on directories

scp -r /Applications/XAMPP/htdocs/keypairfile.pem uploads ec2-user@publicdns:/var/www/html where uploads is a directory returns Permission denied (publickey). However scp -i /Applications/XAMPP/htdocs/keypairfile.pem footer.php…
user3015797
  • 847
  • 1
  • 6
  • 8