
我正在嘗試從 ftp 網站下載一些數據,但登入時遇到問題。我知道用戶名/密碼是正確的,因為它在我互動使用 ftp 時有效。但是,當我嘗試使用 wget 時,我得到:
Logging in as $username...
Login incorrect.
我已經從命令列嘗試了以下命令:
wget -r -nd -A "path/to/data/*/*hdf" --ftp-user=$username --ftp-password=$password ftp:$ftpSite
wget -r -nd -A "path/to/data/*/*hdf" --user=$username --password=$password ftp:$ftpSite
wget -r -nd -A "path/to/data/*/*hdf" --ftp-user=$username --ask-password ftp:$ftpSite
wget -r -nd -A "path/to/data/*/*hdf" --user=$username --ask-password ftp:$ftpSite
我總是遇到同樣的「登入不正確」失敗。
我從命令列運行而不使用變數。我僅在這個問題中使用變數來審查敏感資訊。
我會在 ftp 中使用 mget,但據我了解,我不能使用通配符從多個子目錄中取得檔案。當我嘗試“mget */*hdf”時,出現“沒有這樣的檔案或目錄”錯誤。不過我知道資料在那裡,因為當我 cd 進入其中一個子目錄並執行“mget *hdf”時,它可以工作
答案1
中指定的使用者名稱和密碼設定.netrc
優先於--user=*
的命令列選項wget
,因此它會忽略命令列中給出的使用者名稱。
請檢查您的~/.netrc
.