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
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/...
-1 votes
1 answer
83 views

Why can't I scp a file to this host while I can ssh to it?

I configured sshd on my remote host with /etc/ssh/sshd_config.d/custom.conf: AddressFamily inet6 PermitRootLogin yes PubkeyAuthentication no Match Address fe80::d075:6982:4410:e071 This is a fresh ...
5 votes
3 answers
7k views

scp error while attempting to copy files

I use scp to transfer files from my android to my MacBook which works like a charm. But I have a folder called John's folder on my MacBook so when I attempt to copy a file inside that directory like ...
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 ...
2 votes
1 answer
2k views

Need to prefer file ownership while uploading through scp

I have been tring to upload a file through a normal user to the Amazon Gnu/Linux server, but file owner is not preferring after a successful upload. File ownership is taken from the directory, not ...
0 votes
1 answer
32 views

Copy all files with the directory structure since the last run on remote server

I would like to scan for my /tmp/ directory now and then and check what files have been changed since I last time did it. All files that have been changed should be copied to remote server (as a ...
0 votes
2 answers
60 views

SCP : copy the directory but only with specific files

I am trying to copy the directory but only with the specific files. sudo scp -r user@ip:'ls /nas1/logs/tomcat/dev-main/dev-main*|grep localhost_access_log.2023-09-21.txt' /home/test If the files are ...
-1 votes
1 answer
4k views

Uploading a local file to a server using mobaXterm?

I want to upload files from my local computer to a remote server SSH through MobaXterm. I keep running into different issues that simply don't allow me to do this. I'm running Debian GNU/linux 10 (...
0 votes
1 answer
30 views

SCP: Unable to transfer between two (remote) hosts

One is using passphrase auth, the other is not. # scp -i ~user/.ssh/id_rsa_test01 user@test01:/tmp root@test02:/path/to/test01_bkp/ ssh: Could not resolve hostname test02: Name or service not known ...
236 votes
5 answers
257k 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 ...
1 vote
0 answers
80 views

subsystem request failed on channel 0

When I tried to copy files from linux server using scp like this: > scp [email protected]:/volume1/DownloadStationStore/containerd-1.6.12-linux-amd64.tar.gz . subsystem request failed on channel 0 ...
5 votes
4 answers
2k views

Run the same script on several servers through SSH

I regularly need to update some Ubuntu 12.04 (Precise Pangolin) servers (Rackspace). What I do now is: Copy a file to a server using SCP Log on to the server using SSH Stop Tomcat Do some ...
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?
0 votes
0 answers
112 views

scp -O (legacy protocol) option per config file?

I basically have the same problem as described (and solved) over at SO. This is: scp to some hosts which do not support SFTP subsystem is only working if I provide the -O flag. However is there a way ...
0 votes
1 answer
112 views

How to compress multiple files quickly using tar

I need to transfer multiple files to a HPC cluster. Currently, I've been using the scp command but it takes about 10 minutes or more to transfer one file (about 1.4GB each). I've seen that using tar ...
-1 votes
2 answers
107 views

Copy file from Server A to Server B

I have requirement to copy files from Server A to Server B And then move the copied files Server A to Archive folder I have written the script, but it takes the directory name differently. Copying ...
0 votes
1 answer
19 views

How I can autodetect remote home folder when scp?

I am making an automation script and I want to scp a file from user's home folder to my pc. scp user@host:/home/user/file.txt ./ In my case I expect the file to always be in user's home folder ...
-1 votes
1 answer
451 views

SCP copy remote to local returns "Read-only file system" error on remote folder

I used the following command: scp -r root@IP:/home/user/remotefolder /localfolder After entering my passphrase (I'm using SSH key), I get the following error: /remotefolder: Read-only file system ...
0 votes
1 answer
18 views

I try to copy a file from a GCP instance to my local machine, but powershell gives me a "Permission denied: (publickey)"

I created a GCP instance, and I created a private and public key on kali linux, I saved this key in the metadata of GCP, so I can access the instance through my kali machine. Then, I need to copy a ...
3 votes
3 answers
1k views

How do I list files in the same order as scp -rp copies them?

How do I list files in the same order as scp -rp copies them? I need to know this because sometimes I need to ctrl-C an scp and later want to copy the remaining files.
0 votes
1 answer
79 views

using scp copy file from current directory to remote machine's corresponding location without defining that full path

is there way to copy file or folder to remote machine with the same address as current directory where I'm running scp from defining only file's name, eg: [user@machine current_location]$scp ./...
7 votes
5 answers
13k views

scp to remote Windows hosts with spaces in path: ambiguous target

I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note ...
0 votes
2 answers
10k views

How to specify port for scp for a remote server?

I have two remote nodes that I am trying to send files from one to another. scp remote1:~/testSCP [email protected]:~/ I have ~/ssh/config set up in my local machine so, it is using port 2222 by ...
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....
0 votes
1 answer
508 views

How to download root user owned files via scp or rsync as a sudo user?

How to download the file which requires root permission from a remote server (via scp or rsync) as a sudo-user (non-interactive way)? Note that this sudo-user is not configured to not require the ...
0 votes
2 answers
141 views

How to delete a filename ":?"

I create a file name :~ on bash shell by accident scp foo :~ How to delete it?
0 votes
2 answers
66 views

Copy gitignored files from host A to host B (rsync?)

I have a git repo where several files containing sensitive info are gitignored. These files are located in various subdirectories at various depths. Host A has all these files in place. I've cloned ...
-1 votes
1 answer
236 views

Why is rsync/scp slow from one server but fast from another?

I have 300 GB of large files located in server A. I am at home trying to copy those files, and both scp and rsync are painfully slow (80 KB/s or less). I also have access to another server B. I can ...
7 votes
2 answers
34k views

SCP and delete a files from source

I Have a list file File_Transfer_List.txt which contains list of file to do scp My requirement is I need to do scp that files given in the list file and then delete the files from source location. ...
6 votes
2 answers
1k views

scp many files without reentering password, all different paths [duplicate]

How can I achieve the result of many of scp ~/here/is/one me@remote:~/where/it/goes scp ~/yet/another me@remote:~/the/second/place scp ~/the/number/three/one me@remote:~/foo/bar/qux with only ...
4 votes
1 answer
2k views

scp requires directory of same name to exist on target server

I'm using scp to upload a directory to a remote server. However, if the remote server does not have a "target" directory of the same name, I get a "No such file" error. Note that ...
0 votes
1 answer
106 views

How to use scp to copy to VM?

My mininet virtual box hostname mininet-vm ip a shows inet 10.0.2.15/24 From my client, transferring to the remote VM: scp 6jan.txt [email protected] I can not see any transferred files. Why?
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?
1 vote
1 answer
246 views

How to : use scp to append public key from linux(client) to windows (server with openssh running) in c:\ProgramData\ssh\administrators_authorized_keys

I am trying to copy a client key from Linux(Ubuntu) to Windows server as an administrator user. so far i am able to achieve this by using following steps: I am using bash in linux and powershell 7.3....
2 votes
1 answer
11k views

How to download a file from a remote server to a local folder on my mac using ssh

I'm struggling to download a file from a remote server to a folder on my mac using ssh. I've remoted onto the box successfully and browsed to the folder where the file I want to copy (file1.txt). ...
3 votes
2 answers
3k views

SCP files without user interaction

I am planning to copy some files to entire network of linux machines, but when I tried to use scp it asked for confirmation and I need to type "yes" and after that I have to enter the password. Is ...
1 vote
0 answers
505 views

Multihop ssh works but scp closes with "Connection Closed"

I am trying to transfer a file from my local machine to a remote machine through an intermediate hop. localmachine -> hop_server -> destination_server As suggested by https://serverfault.com/a/...
8 votes
3 answers
33k views

scp stuck when trying to copy files from Linux to windows

I use the following scp syntax in order to transfer a lot of files from Linux red-hat 5 to windows machine (under Temp directory). SSH server is already installed on windows machine. I use this line ...
0 votes
1 answer
164 views

Does a cancelled scp transfer overwrite files with the same names?

In the remote directory I have a file 'checkpoint.tar', I also ended up transferring a file with the same name 'checkpoint.tar' from my home directory to the remote directory via scp. I then cancelled ...
1 vote
1 answer
244 views

How to let user can only read files?

I have some new files to release every day. My coworker needs to sftp/scp to my Linux server to copy these files. I don't want him to do any file delete/move/execution...etc, the only thing he can do ...
0 votes
1 answer
41 views

SCP from a distant server with a cumulative size limit

I want to copy a number of files from a distant server to local computer, such that the total size of the files does not exceed certain limit, as I do not locally have enough disk space; and the files ...
5 votes
3 answers
8k views

Slow scp transfer speed over wan

I have got a 300mbit symmetrical fiberoptic line, and I have got to transfer a 51MBYTE tar file from HOST A (fiberoptic 300mbit) to HOST B (digitalocean machine with more than gigabit bandwith). On ...
1 vote
1 answer
157 views

Transferring very large dataset from cluster to a storage server

We have to move a set of very large data (in petabytes) from HPC cluster to a storage server. We have a high capacity communication link between the devices. However, the bottleneck seems to be a fast ...
0 votes
0 answers
137 views

SCP file from A via B to localhost

I have a file on a server I would like to copy to my localhost. I can access the file from my localhost via: ssh richard@B -t ssh richard@A then richard@A$ sudo bash (with password) then here is the ...
0 votes
0 answers
39 views

Piping not working as expected with SCP [duplicate]

I am trying to pass the password to scp command so that it doeskin prompt for it. I am doing it like this. echo "pwd" | scp -r $files_path $user@$server:$target On one server it is working ...
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 ...
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....
0 votes
0 answers
90 views

SSH server allows login but refuses connection when trying to copy a file

I am able to log into my ssh server both using a password and also with key. But when I try to copy a local file to the ssh server (rsync or scp) it refuses the connection which is very strange. So ...
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, ...
1 vote
1 answer
2k views

Cannot scp folders from user computer to server

For some reason I can no longer scp folders from my desktop Mac to our Linux server. Here's the error: (base) my_computer:~ username$ scp -r /source_directory/filename user@server:/home/user/...

1
2 3 4 5
16