115
votes
73
votes
Accepted
How does using the tilde work as a shortcut to my home directory?
~ is your home directory.
~foo is the home directory of user foo, if such a user exists, or just a directory named ~foo, if that user doesn't exist.
Hence, in:
scp ~Desktop/Volenteer.png jay@...
- 188k
30
votes
Accepted
How do I scp files of size less than x?
you can use 'rsync' command which has an option to controlling the file size to be excluding.
rsync -rv --max-size=100m /path/in/local/ server:~/project/
from 'man rsync',
--max-size=SIZE don'...
- 34.6k
28
votes
Progress bar for scp command
As of 2018, progress and ETA are shown by default and could be disabled by -q
- 380
23
votes
Accepted
How do I use scp backwards?
The syntax is:
scp source destination
So this time the source is your local (client) computer and the destination is the remote (server) computer.
If the file you want to send is ~/homecomputer/...
- 88.8k
22
votes
How does using the tilde work as a shortcut to my home directory?
Have a read through of the GNU documentation for Bash Tilde Expansion (as I should have before my first iteration of this answer).
~/Desktop and ~j0h are doing fundamentally different things, which ...
Oli♦
- 286k
21
votes
Accepted
How do I scp a filename with spaces?
Spaces in directories or filenames are the natural enemy of a Linux system but can of course be escaped with due diligence. There are 3 possibilities that you could try:
scp [remote username]@192.168....
- 36k
21
votes
Accepted
How can I perform a secure automatic file transfer between two servers?
You can't hide anything on the system from someone who have root access. Even you are using encrypted home directory while you are logged-in it is decrypted and the root user can access the data.
...
- 28.8k
19
votes
Accepted
What is the difference between scp and cp?
TL;DR Read the man pages:
man scp
man cp
From man scp
NAME
scp — secure copy (remote file copy program)
SYNOPSIS
scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l ...
- 87.7k
15
votes
What is the difference between scp and cp?
scp is really for remote copying over SSH. Eg:
scp /path/to/local/file user@server:/path/to/target/dir/
Oli♦
- 286k
15
votes
Accepted
Permitting scp but not ssh - without scponly
According to this serverfault.com answer Allow SCP but not actual login using SSH, one currently supported way is by using rssh, which is available from the universe repository:
sudo apt-add-...
- 127k
13
votes
How can I avoid having to enter a password for an scp command by hard-coding the password into my script?
SSH key authentication is convenient and secure
Please do not hardcode a password into the shellscript, because it is easy for other people to read it.
Login with key authentication to ssh is what ...
- 43.6k
11
votes
How to SCP a file from Mac -> Ubuntu VirtualBox?
User port forwarding
- With guest running, go to VirtualBox settings/network
- Click Port Forwarding
- Name "ssh", protocol TCP, Host port = 3022, Guest port = 22
Then, on the host,
scp -P 3022 ...
- 111
10
votes
Accepted
How to copy (or move) files from remote machine to local machine?
nullmeta's answer is completely valid, and perhaps nullmeta will edit to provide the clarification you're looking for. I'm posting a separate solution altogether to account for the situation where it ...
- 4,520
9
votes
SCP from remote to local does not work
You have a pretty fundamental mis-understanding of how scp works.
Assuming "local" is where you want the file to end up, and "remote" is where the file is now, do this:
scp user@remote:/path/to/...
- 565
9
votes
Copy files from remote Ubuntu to local Mac
Excellent answers above. Additionally, if you need to use a certificate for authentication, you can use the -i flag.
scp -i /path/to/cert username@192.168.1.111:/path/to/myfile.txt /Users/Jamie/local/...
- 190
8
votes
What is the difference between scp and cp?
scp or Secure Copy is primarily used to copy between a local host and remote host, or two remote hosts, via ssh
The cp command is for copying files locally, i.e. within your host's system.
The man ...
- 19.4k
8
votes
Accepted
How to make scp go faster?
Two ideas:
Experiment with a different cipher
Use 'on the fly' compression
1. Experiment with a different cipher:
One idea is to test the various ciphers which are available through scp and try to ...
- 36k
8
votes
Accepted
Escape username spaces in SCP
You could use ~/.ssh/config. It's the per-user configuration file for SSH (and commands based on SSH like scp and sftp). Create it, if it does not exist, and add:
Host 192.168.0.42
User "User ...
- 188k
8
votes
Accepted
scp \033H message
The fix for this is typically simple. Usually you can inspect .bashrc, find the line or couple of lines near the top that are causing the problem, and move or delete them. The hard part is convincing ...
- 115k
6
votes
Why does scp get stalled? How do I resolve it?
I've managed to solve it by using rsync:
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /tmp/bigfile.txt user@host.com:/tmp/
- 161
6
votes
Where would you find SCP logs?
scp is executed internally just as ssh command and transferred files are not logged. You have only authentication logs in /var/log/auth.log or somewhere like this.
- 6,435
6
votes
How can I perform a secure automatic file transfer between two servers?
Use rsync in a cronjob, as usual.
On the rsync client, users with "sudo" privilege will be able to see the username and password needed to access the specific folders shared by the rsync ...
- 4,762
5
votes
Copy files from a server via ssh to dropbox.
Maybe
https://couchdrop.io/
The secure, easy to use Cloud scp and http upload server.
scp $filename $username@ssh.couchdrop.io:
- 405
5
votes
Accepted
scp, where did my files go?
Note what you're trying to achieve with this scp command:
root@hostname:/home/gsamaras/konstantis/cholesky#
You are root on machine named hostname
scp gsamaras@hostname:konstantis/cholesky/o_755....
- 156
5
votes
Accepted
Copy a list of files to remote computer while creating parent folders
Using rsync:
rsync -av --files-from=filelist.txt . remote:/some/location/
Run this from the directory where you have run find, the root of the directories, where the filelist.txt currently is.
--...
- 88.8k
5
votes
How to transfer / copy files from docker container to local directory in ubuntu 18.04?
docker ps
Then once you have your container ID, you can run the following:
docker cp container_id:/path/to/your_file.txt /path/on/your/host
- 161
4
votes
copy with ssh with port other than 22
You can create file ~/.ssh/config and put relevant information for the remote host in there:
Host remotehost.com
Port 2000
User username
See man page for ssh_config.
This allows you to then run ssh ...
- 171
4
votes
Accepted
scp - files getting different sizes in destination folder
This has no matter with scp. This is an issue of file system and the used block size.
In simple word and as an example if you use a block size of 512 KB and you have a file 2.5MB size then this file ...
- 81.2k
4
votes
How can I connect to a server via SCP in Lubuntu 15?
PCManFM supports mounting of network file shares.
In the main menu, select Go > Connect to Server...
I'm not familiar with WinSCP, but I assume it uses SSH. To mount an SSH share, select SSH and ...
- 1,047
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scp × 237ssh × 129
server × 47
networking × 26
command-line × 25
bash × 19
14.04 × 11
16.04 × 11
rsync × 11
sftp × 11
permissions × 9
scripts × 9
12.04 × 8
virtualbox × 6
copy × 6
transfer × 6
cp × 6
windows × 5
file-sharing × 5
files × 4
sudo × 4
cron × 4
ftp × 4
wireless × 3
samba × 3