$RYSNC_PASSWORD 未正確讀取/回應(雪豹)

$RYSNC_PASSWORD 未正確讀取/回應(雪豹)

忽略安全性問題,我使用以下腳本將音樂庫從 MacBook Pro(執行 Snow Leopard)同步到網路上的檔案儲存(CentOS 4):

rsync -rav --progress --partial -e "ssh" ~/Music/iTunes/* user@scramasax:~/music/iTunes-scissor:~

當我嘗試使用命令列 ()、密碼檔案 ( --password-file) 或環境變數中提供的密碼時RSYNC_PASSWORD,登入仍會進行交互,要求我再次輸入密碼。

我將轉向網路上的預先共用金鑰,但在不可能的情況下,例如rsync將檔案傳送到網路伺服器,能夠成功地將密碼嵌入到腳本中將非常有幫助。

答案1

請注意這些部分的內容man rsync不得不說一下ssh。您可能必須設定密鑰檔案。

--password-file
此選項可讓您在檔案中提供密碼以存取 rsync 守護程式。該文件不能是所有人可讀的。它應該只包含密碼作為一行。

          This option does not supply a password to a remote shell  trans‐
          port  such  as  ssh; to learn how to do that, consult the remote
          shell's documentation.  When accessing an rsync daemon  using  a
          remote  shell  as  the  transport,  this  option only comes into
          effect after the remote shell finishes its authentication  (i.e.
          if  you  have  also  specified a password in the daemon's config
          file).

RSYNC_PASSWORD
將 RSYNC_PASSWORD 設定為所需的密碼可讓您在無需使用者介入的情況下執行與 rsync 守護程式的經過驗證的 rsync 連線。請注意,這不會向遠端 shell 傳輸(例如 ssh)提供密碼;若要了解如何執行此操作,請參閱遠端 shell 的文件。

相關內容