透過 SSH 將資料夾下載到本地

透過 SSH 將資料夾下載到本地

我正在學習 SSH,因為似乎沒有適用於 Mac 的良好 SSH GUI。我知道如何進行資料庫轉儲、瀏覽目錄等,但我需要學習的最後一個難題是如何從伺服器下載資料夾/整個目錄並下載到本機電腦上,以便我可以將它們移動到另一台伺服器。

任何幫助將不勝感激。

答案1

scp -r user@host:/path/to/folder/ local-copy-of-folder

如果您設定了 SSH 金鑰,則可以使用 Tab 鍵完成遠端檔案/資料夾。

答案2

你可以 scp - 這將允許你在主機之間安全地複製。

要了解更多信息,您可以執行 man scp

它位於 Linux 上的 /usr/bin 中。 SCP 或安全複製指令將檔案和目錄從一台電腦批次複製到另一台電腦。 (對於互動式使用者介面,您可以使用 SFTP,如「user545035」所述。它會加密兩台電腦之間的所有通訊。

$ scp my file remote.example.com:newfile
$ scp -r mydir remote.example.com:
$ scp remote.example.com:myfile .
$ scp -r remote.example.com:mydir .

若要在遠端系統上指定備用使用者名,請使用 username@host 語法:

$ scp myfile [email protected] :

有用的選項:

-p:複製時複製所有檔案屬性(權限、時間戳記)。

-r:遞歸複製目錄及其內容。

-v:產生詳細輸出,對於調試很有用。

SFTP (host|username@host) openssh-client位於/usr/bin目錄。 sftp 程式在兩台電腦之間互動複製檔案。 (與 scp 不同,scp 批次複製檔案。)使用者介面與 ftp 非常相似。

$ sftp remote.example.com
password: ******
sftp> cd MyFiles
sftp> ls
README
...
sftp> get README
Fetching /home/solidariti/Myfiles/README to README

如果您的使用者名稱與本機使用者名稱不同,請使用 username@host 參數:

$ sftp [email protected]

希望這能讓你上路。

答案3

只是...

scp -r username@remote:/path/to/folder/ /dest/local/path

在 Windows 上:

scp -r username@remote:/path/to/folder/  C:\\Users\\User\\\Documents

參考文獻:[1]:http://en.wikipedia.org/wiki/Secure_copy [2]:http://en.wikipedia.org/wiki/FTPS

答案4

賽博鴨當我使用 Mac 時,它是我最喜歡的 SSH/FTP/DAV GUI。從那時起,它似乎也已更新為包含 Google Docs 和 S3。

相關內容