Skip to main content
Share Your Experience: Take the 2024 Developer Survey
23 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:$...
Lefty G Balogh's user avatar
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 ...
Jenny D's user avatar
  • 28.1k
14 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 ...
kasperd's user avatar
  • 30.7k
11 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://...
Angelo Dureghello's user avatar
10 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.
iCPSoni's user avatar
  • 101
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 ...
Aaron's user avatar
  • 2,859
8 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\...
Oscar Javier Gómez Sánchez's user avatar
8 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 ...
donhector's user avatar
  • 211
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 ...
Sven's user avatar
  • 99.6k
7 votes

How to make scp copy hidden files?

To copy only hidden files, Use this command scp -rp /path_to_copy_hidden/.[!.]* user@host:/path_to_paste/ Actual game is the /.[!.]* tag that is referring to files starting with .(hidden)
Shahzaib Hayat Khan's user avatar
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. ...
Carlo Miguel Cruz's user avatar
7 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 ...
Sven's user avatar
  • 99.6k
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@...
texas-bronius's user avatar
6 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 ...
Roberto Paz's user avatar
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 ...
shodanshok's user avatar
  • 50.9k
6 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 ...
Jesse Scherer's user avatar
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 ...
Lacek's user avatar
  • 7,473
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 ...
Giannis's user avatar
  • 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 ...
dirkaholic's user avatar
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 ...
alexus's user avatar
  • 13.5k
4 votes
Accepted

I changed the permissions on a directory, now I can't SCP

Please read the output carefully. In my opinion the problem is not the folder but the login. debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: ...
cmoetzing's user avatar
  • 156
4 votes

Is it possible to scp asynchronously?

a) Use screen or tmux to put operations in the background. b) Use rsync for this purpose instead of scp. It is much more useful as you can easily resume transfers if they fail. c) Normally, you ...
Sven's user avatar
  • 99.6k
4 votes
Accepted

Using google drive to dynamically expand VPS storage

Basically giving a path to a Google Drive folder on linux without downloading the folder. This kind of functionality has a name: mounting. Mounting a filesystem means making it accessible at a ...
Esa Jokinen's user avatar
  • 50.1k
4 votes

Up-to-date alternatives of rssh or scponly

One possibility is ProFTPD's mod_sftp module, which does just what you want (chroot, SCP/SFTP only, no shell). Hope this helps!
Castaglia's user avatar
  • 3,389
4 votes

scp failing with vast.ai

scp -P <port> <local file> root@<ip>:<dir> Try with a capital "-P" for the port flag.
user3478306's user avatar
4 votes
Accepted

Data corruption when rsync command fails

It does have a built-in mechanism. The new file will be created with a temporary name, and will only be renamed to the "real" filename once it's completely transferred. You should read the rsync man ...
Jenny D's user avatar
  • 28.1k
3 votes

Secure file transfer in linux without SSH?

The following is simple and awesome: python -m SimpleHTTPServer 8888 This starts a new http file server for current directory. Supposed there is a file named foo in current directory, you can ...
nullne co's user avatar
3 votes

how to copy file from local to remote via ssh

Your command line doesn't specify the port number correctly. As seen in the scp man page: -P port Specifies the port to connect to on the remote host. Note that this ...
Michael Hampton's user avatar
3 votes

Download public & private keys from Google Cloud Instance

Consider to use command line tools: Install Cloud SDK for your platform. This would initialize your local environment. First time you'll try to access instance via gcloud SSH/SCP functionality, Cloud ...
PrecariousJimi's user avatar
3 votes

ssh forced command: sftp/scp only

This should be a comment, but its a bit long. You've failed to adequately describe your objective. While I can make some inferences, extrapolating this to a proposal would be futile. While there ...
symcbean's user avatar
  • 22.6k

Only top scored, non community-wiki answers of a minimum length are eligible