20
votes
scp without known_hosts check
For those of us who are less versed in Linux shorthand, the full syntax would look something like this:
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r $source $user@$host:$...
- 415
16
votes
Can scp copy directories recursively?
The best way is to use rsync over SSH
rsync -a -essh /source/ user@dest-server:/dest/
rsync -a -essh user@source-server:/source/ /dest/
My favorites options are -Pazvessh --delete :
-a : archive ...
- 725
16
votes
SCP copy windows local file to linux remote folder
The best way to copy files from Windows to Linux using the command line is through pscp. It is very easy and secure. For pscp to work on your windows machine, you need it add its executable to your ...
- 281
14
votes
Accepted
SCP Changing text file contents
Your scp command sends the file to the root of the target server - you're scp:ing to /myfile. When you later look at the file, you're not giving the full path. It looks as though you have once tried ...
- 27.6k
13
votes
Accepted
Why is scp with compression slower than without?
Quoting man ssh (which is the base used by scp):
Compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.
The problem is that ...
- 98.1k
13
votes
Accepted
SCP with password authentication only doesn't ask me for password
The best solution would be to ask the person who disabled publickey authentication on that server why and then go fix that. Using publickey authentication is more convenient and more secure than ...
- 30.2k
12
votes
Why is FileZilla SFTP file transfer max capped at 1.3MiB/sec instead of saturating available bandwidth? rsync and WinSCP are even slower
There are three common factors that affect a transfer speed:
Bandwidth – An obvious factor that's apparently not your trouble.
Network delay/latency – The SFTP is packet oriented-protocol. When ...
- 7,544
10
votes
Accepted
Replace scp with sftp
Rsync over sftp or chroot sftp
Edit: To be clear, the LFTP client supports numerous protocols, including FTP, HTTP, FISH, SFTP, HTTPS, FTPS and BitTorrent. In this example, we are using SFTP. The ...
- 2,849
9
votes
SCP transfer only modified files
Generally one asks for scp because there is a reason. I.e. can't install rsyncd on the target.
files=`find . -newermt "-3600 secs"`
for file in $files
do
sshpass -p "" scp "$file" "root@$IP://...
9
votes
scp - Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
I was facing the same problem. Hope this will work for you.
scp -rp -i yourfile.pem ~/local_directory username@instance_url:directory
Permission should also be correct to make this work.
- 91
8
votes
Can scp copy directories recursively?
After looking for the recursive copy flag, and successfully used it thanks to this post, I would like to post just a suggestion.
If the case is that you are copying (recursively) a directory. Maybe ...
- 203
8
votes
Accepted
SSH scp: cannot stat file, that seems to exist
The syntax of scp is not correct. Try
scp matous@xxx:D1.db /home/matous
Without the colon (:), scp will try to interpret matous@xxx/D1.db as a local path.
Note that I omitted the leading /. If ...
- 98.1k
8
votes
Accepted
scp with special username
Try something like this:
RUSER='SLOS755513-3:SL1255513'
HOST=objectstorage.net
DIR=/backup
scp -o user=$RUSER /home/user/my_log.txt $HOST:$DIR
This will make the user part explicit so scp doesn't ...
- 98.1k
7
votes
How do I do Multihop SCP transfers between machines?
It's possible and relatively easy, even when you need to use certificates for authentication (typical in AWS environments).
The command below will copy files from a remotePath on server2 directly into ...
- 181
7
votes
Accepted
Up-to-date alternatives of rssh or scponly
I recommend to just use the common chrooted internal-sftp that is included with most OpenSSH servers. SFTP clients are available on all operating systems so I do not see any problems with adoption.
...
6
votes
How do I do Multihop SCP transfers between machines?
This isn't scp (which OP requested), but I found it super simple to use rsync to copy from local to remote over a single hop with:
rsync -v -e 'ssh -A -t user@jumpserver ssh -A -t user@...
6
votes
SCP copy windows local file to linux remote folder
I would highly recommend to use WinSCP if you're a Windows user. It has a good intuitive interface and gets the job done easily and with no pain.
Download link
- 161
6
votes
SCP copy windows local file to linux remote folder
to copy a file from windows to linux write:
scp -i privatekey pathFileOnWindows user@publicIp:pathDirectoryLinux
(the colon : is important!)
Example:
//I am located here in my console
C:\Users\...
6
votes
Accepted
rsync - file is 8 bytes larger on recipient
du file is not a suitable way to measure file size. Even the very first line of the man page says « du - estimate file space usage » (my italics).
Instead, use one or more of the following methods (...
- 1,589
6
votes
scp - Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Run scp with verbose mode (-vvv) and see if you can identify the problem there. It could be the permissions on your .ssh/authorized_key file on the destination (or even the source) are too open.
6
votes
Accepted
Jenkins execute shell scp
echo 'password' | sudo -S scp ...
no, it is not a good idea and it does not work, as discussed many times around SE. SSH flushes input before reading password. You should set up ssh keys.
If keys ...
- 9,465
6
votes
Accepted
File transfer speed in LAN network
The receiver side is linking at only 100 Mb/s:
e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None
which translate to about 12.5 MB/s of maximum raw bandwidth. After taking into ...
- 45.5k
6
votes
Is it possible to set that path of the scp command to use by OpenSSH sshd daemon?
It isn't the SSH daemon which uses the scp program directly, so no, you can't reconfigure it to use another binary. You need to remove all but the "right" scp binaries from the system, or rewrite the ...
- 7,045
5
votes
How to _MOVE_ files with scp?
If doing it in two steps is not a problem, you can use scp to copy the file from the remote server, and then execute ssh -e "rm /path/to/file" to remove from disk. When moving files especially between ...
- 61
5
votes
Accepted
Delete files older than X days on remote server with SCP/SFTP
This question is very old but I still wanted to add my bash only solution as I was just searching for one when I came here. The grep tar in the listing command is just for my own purpose to list only ...
- 176
5
votes
scp - Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Turns out I needed to specify the identity in the scp command something like so :
scp -rp -i /root/.ssh/server /home/user-data/* root@111.111.111.111:/home/user-data
where '/root/.ssh/server' is the ...
- 263
5
votes
Accepted
How to maintain ssh connection for multiple scp transfers?
Nobody took the opportunity to complete answer and I didn't find any duplicate, so here we go.
You can set up ~/.ssh/config, with these options:
Host machine1
HostName machine1.example.org
User ...
- 9,465
5
votes
Replace scp with sftp
You could use a batchfile aproximation:
sftp -b batchfile [user@]host
a batchfile includes a sequence of commands that must reproduce "scp" operation with equivalent ftp commands:
cd ...
- 171
5
votes
Accepted
how to copy file from local to remote via ssh
per man scp
-P port
Specifies the port to connect to on the remote host. Note that this option is written
with a capital ‘P’, because -p is already reserved for preserving the ...
- 12.8k
5
votes
Accepted
scp - What do the "-d" and "-t" options do?
The -d flag is a server flag like -t. In this case it means that the target should be a directory (versus a regular file) -- attempts to scp to a file instead of into a directory will be killed.
In ...
- 281
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scp × 435ssh × 197
linux × 114
rsync × 53
sftp × 35
ubuntu × 29
bash × 27
file-transfer × 25
windows × 17
amazon-ec2 × 15
centos × 13
unix × 13
shell × 13
backup × 11
permissions × 11
ftp × 11
ssh-keys × 10
files × 10
putty × 9
copy × 9
security × 8
ssh-tunnel × 8
networking × 7
amazon-web-services × 7
debian × 7