这可能是一个愚蠢的问题,但当连接到 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
{
....
}
答案1
在某些特定系统中,“帐户”很少使用,甚至根本不使用。您会知道何时需要使用它。大多数情况下您不需要。这可能是一些遗留的东西。毕竟 FTPRFC 959定义“帐户”功能是 1985 年的!
ACCT
FTP RFC 959 对(account) 命令的含糊说明如下:
参数字段是用于标识用户帐户的 Telnet 字符串。该命令不一定与 USER 命令相关,因为某些站点可能需要帐户才能登录,而其他站点仅需要帐户才能进行特定访问,例如存储文件。在后一种情况下,命令可能随时到达。