複製遠端檔案(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
參考資料
- Run / Execute Command Using SSH - nixCraft
- linux - How to download a file from server using SSH? - Stack Overflow
- How to Use SCP Command to Securely Transfer Files | Linuxize