Ftp

FTP 伺服器上使用的帳戶欄位與使用者名相比是什麼

  • September 27, 2021

可能是一個愚蠢的問題,但是當連接到 FTP 伺服器時,有時會有一個帳戶選項。這與使用者名有什麼意義?

例如,從 Apache FTP 客戶端查看此方法:

/**
* Login to the FTP server using the provided username, password,
* and account.  If no account is required by the server, only
* the username and password, the account information is not used.
*
* @param username The username to login under.
* @param password The password to use.
* @param account  The account to use.
* @return True if successfully completed, false if not.
* @throws FTPConnectionClosedException
*      If the FTP server prematurely closes the connection as a result
*      of the client being idle or some other reason causing the server
*      to send FTP reply code 421.  This exception may be caught either
*      as an IOException or independently as itself.
* @throws IOException  If an I/O error occurs while either sending a
*      command to the server or receiving a reply from the server.
*/
public boolean login(final String username, final String password, final String account)
throws IOException
{
   ....
}

“帳戶”很少用於某些特定係統,如果有的話。您將知道何時需要使用它。大多數情況下你沒有。這可能是一些遺留的東西。畢竟定義“帳戶”功能的 FTP RFC 959是從 1985 年開始的!

這是 FTP RFC 959 對ACCT(帳戶)命令的模糊表述:

參數欄位是標識使用者帳戶的 Telnet 字元串。該命令不一定與 USER 命令相關,因為某些站點可能需要帳戶才能登錄,而其他站點可能僅需要特定訪問權限,例如儲存文件。在後一種情況下,命令可能隨時到達。

引用自:https://serverfault.com/questions/1078800