使用 scp 指令

可以使用 scp 指令來透過一個安全且加密的連線在機器間傳輸檔案,就如同 rcp 指令。

傳輸一個本機檔案到遠端機器的一般語法如下:

scp localfile username@tohostname:/newfilename

localfile 代表來源檔案,而 username@tohostname:/newfilename 代表目的地。

如要傳輸本機檔案 shadowman 到您在 penguin.example.net 主機中的帳號,請在 shell 提示符號下輸入以下指令(使用您的使用者名稱取代 username):

scp shadowman username@penguin.example.net:/home/username

這將會傳輸本機檔案 shadowman 到 penguin.example.net 主機上的 /home/username/shadowman

如果要傳輸一個遠端的檔案到本機系統,一般的語法如下:

scp username@tohostname:/remotefile /newlocalfile

remotefile 代表來源檔案,而 newlocalfile 代表目的地。

還可以指定多重的檔案當作來源檔案,例如要傳輸 /downloads 目錄的內容到遠端機器 penguin.example.net 上一個既存的目錄稱為 uploads,請在 shell 提示符號下輸入以下指令:

scp /downloads/* username@penguin.example.net:/uploads/
arrow
arrow
    全站熱搜

    ITMan 發表在 痞客邦 留言(0) 人氣()