Linux/scp

From Omnia
Revision as of 22:40, 23 March 2024 by Kenneth (talk | contribs) (→‎Recursive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Install

# Install in docker
apt install openssh-client

Recursive

scp -r local_path kenneth@remote_host:~/

Port

scp -P 9999 local_path kenneth@remote_host:~/

Copy path with spaces

scp -r myserver.com:"/path/with/a/Space\\ In\\ It" ./
scp -r myserver.com:"\"/path/with/a/Space In It\"" ./
scp kenneth@remote_host:"/my iso/en_ws_2003_ent_x64_vl.iso" .


References:

sshpass

# password in history:
sshpass -p "password" scp -r user@example.com:/some/remote/path /some/local/path
# password not in bash history:
sshpass -f "/path/to/passwordfile" scp -r user@example.com:/some/remote/path /some/local/path

ref: [1]