[ftp] how can I login anonymously with ftp (/usr/bin/ftp)?

I'm trying to connect to an FTP server which allows anonymous access, I don't know how to specify the appropriate username/password required to do this though.

I've tried using anonymous/anonymous as the user/pass with no luck, as well the empty string and various combinations of the two, etc.

It's gotta be something simple that I'm missing, I can use connect just fine with curl ftp://server/

Using python:

stu@sente ~ $ cat - | python
import ftplib
ftp = ftplib.FTP("ftp.server")
ftp.set_debuglevel(2)
ftp.connect()
ftp.login()
list = ftp.nlst()
ftp.close()
print "\n", " ".join(list)
^D

*get* '220 ftp.server NcFTPd Server (licensed copy) ready.\r\n'
*resp* '220 ftp.server NcFTPd Server (licensed copy) ready.'
*cmd* 'USER anonymous'
*put* 'USER anonymous\r\n'
*get* '331 Guest login ok, send your complete e-mail address as password.\r\n'
*resp* '331 Guest login ok, send your complete e-mail address as password.'
*cmd* 'PASS **********'
*put* 'PASS **********\r\n'
*get* '230 Logged in anonymously.\r\n'
*resp* '230 Logged in anonymously.'
*cmd* 'TYPE A'
*put* 'TYPE A\r\n'
*get* '200 Type okay.\r\n'
*resp* '200 Type okay.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (12,161,242,12,128,138)\r\n'
*resp* '227 Entering Passive Mode (12,161,242,12,128,138)'
*cmd* 'NLST'
*put* 'NLST\r\n'
*get* '150 Data connection accepted from 208.118.225.99:38451; transfer starting.\r\n'
*resp* '150 Data connection accepted from 208.118.225.99:38451; transfer starting.'
*get* '226 Listing completed.\r\n'
*resp* '226 Listing completed.'

Obin bin pub public sci_tech_med

This question is related to ftp

The answer is


Anonymous FTP usage is covered by RFC 1635: How to Use Anonymous FTP:

What is Anonymous FTP?

Anonymous FTP is a means by which archive sites allow general access to their archives of information. These sites create a special account called "anonymous".

Traditionally, this special anonymous user account accepts any string as a password, although it is common to use either the password "guest" or one's electronic mail (e-mail) address. Some archive sites now explicitly ask for the user's e-mail address and will not allow login with the "guest" password. Providing an e-mail address is a courtesy that allows archive site operators to get some idea of who is using their services.

These are general recommendations, though. Each FTP server may have its own guidelines.

For sample use of the ftp command on anonymous FTP access, see appendix A:

atlas.arc.nasa.gov% ftp naic.nasa.gov
Connected to naic.nasa.gov.
220 naic.nasa.gov FTP server (Wed May 4 12:15:15 PDT 1994) ready.
Name (naic.nasa.gov:amarine): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230-----------------------------------------------------------------
230-Welcome to the NASA Network Applications and Info Center Archive
230-
230-     Access to NAIC's online services is also available through:
230-
230-        Gopher         - naic.nasa.gov (port 70)
230-    World-Wide-Web - http://naic.nasa.gov/naic/naic-home.html
230-
230-        If you experience any problems please send email to
230-
230-                    [email protected]
230-
230-                 or call +1 (800) 858-9947
230-----------------------------------------------------------------
230-
230-Please read the file README
230-  it was last modified on Fri Dec 10 13:06:33 1993 - 165 days ago
230 Guest login ok, access restrictions apply.
ftp> cd files/rfc
250-Please read the file README.rfc
250-  it was last modified on Fri Jul 30 16:47:29 1993 - 298 days ago
250 CWD command successful.
ftp> get rfc959.txt
200 PORT command successful.
150 Opening ASCII mode data connection for rfc959.txt (147316 bytes).
226 Transfer complete.
local: rfc959.txt remote: rfc959.txt
151249 bytes received in 0.9 seconds (1.6e+02 Kbytes/s)
ftp> quit
221 Goodbye.
atlas.arc.nasa.gov%

See also the example session at the University of Edinburgh site.


As others point out, the user name is usually anonymous, and the password is usually your e-mail address, but this is not universally true, and has been found not to work for certain anonymous FTP sites. For example, at least some cPanel sites seem to deviate from the norm, and if given the traditional user name without domain, one of various errors may result:

If the server uses Pure-FTP as the FTP server:

421 Can't change directory to /var/ftp/ error message.

If the server uses ProFTP as the FTP server:

530 Login Authentication Failed error message.

When one of the aforementioned errors occurs when attempting anonymous access, try including a domain with the username. For example, where example.com is the domain used in your e-mail address:

User name: [email protected]

In the specific case of a cPanel site, the password value is unimportant, and may be left blank, but there is no harm in providing a "traditional" anonymous password formatted as an e-mail address.

For reference, this answer is based on content found on a documentation.cpanel.net Anonymous FTP page. At the time of this writing, it stated:

When users log in to FTP anonymously, they must format usernames as [email protected], where example.com represents the user's domain name. This requirement directs your server to the correct public_ftp directory.


Anonymous ftp logins are usually the username 'anonymous' with the user's email address as the password. Some servers parse the password to ensure it looks like an email address.

User:  anonymous
Password:  [email protected]