Linux/scp

From Omnia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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]