[Linux]scp 命令遠程複製

來源:互聯網
上載者:User

標籤:伺服器   linux   scp   

這幾天在介入之前沒有接觸過的系統,搭建環境的使用用到了 scp命令,於是查詢下資料怎麼使用。


scp是secure copy的縮寫,主要用來linux系統之間的檔案和目錄的遠程拷貝

可以很簡單的從另一台伺服器上遠程拷貝檔案和目錄,一般是遠程伺服器沒有開啟ftp,檔案分享權限設定或者web檔案服務等情況下使用


可以使用的前提:

1  要有操作遠程系統的相應許可權

2  使用通道的連接埠沒有被防火牆限制,當然這個連接埠是可以通過選擇指定的,預設的連接埠是22


基本格式

scp [選擇性參數] file_source file_target

-p 指定連接埠: #scp -p 4588 [email protected]:/usr/local/sin.sh /home/administrator

-r  遞迴複製目錄: scp -r www.cumt.edu.cn:/home/root/others/ /home/space/music/

-v 能看到執行過程


從本地複製到遠程:

scp local_file [email protected]_ip:remote_folder_file

scp local_file remote_ip:remote_folder


如果制定了使用者名稱,後面只要輸入密碼就行了,如果沒有寫使用者名稱 就要輸入使用者名稱 和密碼

[[email protected] ~]# scp ./install.log [email protected]:/tmp/[email protected]'s password:install.log

./install.og  本地檔案的路徑

root  遠程系統的使用者

192.168.30.237  遠程系統的ip

/tmp/ 遠程存放檔案的目錄


從遠程複製到本地:

scp [email protected]_ip:remote_file local_file

[[email protected] ~]# scp [email protected]:/tmp/install.log /tmp/[email protected]'s password:install.log                                                                                         100%   35KB  35.0KB/s   00:00
root  遠程系統的使用者名稱

192.168.30.237 遠程系統的ip

/tmp/install.log  遠程系統檔案的路徑

/tmp/  本地存放檔案的檔案夾


本文出自 “orangleliu筆記本” 部落格,請務必保留此出處 http://blog.csdn.net/orangleliu/article/details/38399493

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.