複製远端档案(scp)

Ubuntu 系统网路 ssh 複製远端档案(scp)指令

使用 ssh 複製远端档案(scp)

使用 ssh

scp <your_username>@<your-server-domain>:/remote/dir/file.txt /local/dir

使用金钥

scp -i <your-key> <your_username>@<your-server-domain>:/remote/dir/file.txt /local/dir
scp -i ~/.ssh/id_rsa kejyun@127.0.0.1:/home/remote-kejyun/myfile /home/kejyun

複製目录

複製目录加一个 -r 的参数即可

scp -r -i <your-key> <your_username>@<your-server-domain>:/remote/dir/path /local/dir

使用 ssh 将本地端档案传到远端(scp)

使用 ssh

scp /local/file.txt <your_username>@<your-server-domain>:/remote/dir

使用金钥

scp /local/file.txt -i <your-key> <your_username>@<your-server-domain>:/remote/dir
scp /home/kejyun/local-file -i ~/.ssh/id_rsa kejyun@127.0.0.1:/home/remote-kejyun/

複製目录

複製目录加一个 -r 的参数即可

scp -r -i <your-key> /local/folder/ <your_username>@<your-server-domain>:/remote/dir/path

参考资料