NNTP: A protocol for Usenet

NNTP is the primary protocol used for communication between News servers, as well as between client software and a News server. It is one of the most complex protocols in use on the internet, because of the nature of Usenet news. NNTP's assigned port is 119. NNTP shares more than a passing similarity to SMTP. It does not authenticate senders, and uses very similar headers to NNTP in the body of messages. Unlike SMTP, however, in NNTP, the headers must be valid or the NNTP server will reject the message.

Posting a message

In order to post a message, one uses the POST command. After this command, all further input is considered message headers and body. Posts are terminated by a period on a blank line. Required headers include:
From: your_username@your_host
Newsgroups: my.newsgroup.1,my.newsgroup.2
Subject: My_subject

Additional NNTP commands include:
Postability is either "y", "n", or "m". "y" indicates the group can be posted to, "n" indicates that the group cannot be posted to, and "m" indicates that the group is moderated. There are several other NNTP commands that are used to communicate between NNTP servers that I will not cover here.
An example NNTP session would be:
telnet news.foo.bar 119
Trying 192.168.1.1...
Connected to news.foo.bar.
Escape character is '^]'.
200 news.foo.bar InterNetNews NNRP server INN 1.7 16-Oct-1997 ready (posting ok).
POST
340 Ok
From: foo@bar.baz
Newsgroups: alt.test
Subject: Testing

This is a test

.
240 Article posted
GROUP alt.test
211 1 3393 3393 alt.test
ARTICLE 3393
220 3393 <6653bq$66d$1@news.foo.bar> article
Path: news.foo.bar!not-for-mail
From: foo@bar.baz
Newsgroups: alt.test
Subject: Testing
Date: 4 Dec 1997 02:08:58 GMT
Organization: Foobar Baz Group
Lines: 2
Message-ID: <6653bq$66d$1@news.foo.bar>
NNTP-Posting-Host: baz.foo.bar
Xref: news.foo.bar alt.test:3393

This is a test

.
HEAD 3393
221 3393 <6653bq$66d$1@news.foo.bar> head
Path: news.foo.bar!not-for-mail
From: foo@bar.baz
Newsgroups: .test
Subject: Testing
Date: 4 Dec 1997 02:08:58 GMT
Organization: FooBar
Lines: 2
Message-ID: <6653bq$66d$1@news.foo.bar>
NNTP-Posting-Host: baz.foo.bar
Xref: news.foo.bar alt.test:3393
.
BODY 3393
222 3393 <6653bq$66d$1@news.foo.bar> body
This is a test

.
LIST
215 Newsgroups in form "group high low flags".
alt.activism 0000385432 0000327369 y
alt.aquaria 0000110741 0000109702 y
alt.bbs 0000096752 0000089880 y
alt.config 0000154265 0000135954 y
alt.cult-movies 0000239154 0000219823 y
.
QUIT
205 .
Connection closed by foreign host.
Note that I cut the list of newsgroups short in the response to the LIST command. Moderated newsgroups are discussed in the Abuse section.


NNTP Authentication

Some NNTP Servers support a feature allowing users to log in. This is often useful when the administrator does not want to run an open server, yet must service users whose IP address cannot be depended on. In order to log in, the client sends:
AUTHINFO USER username
AUTHINFO PASS password
These 2 commands must be sent in sequence, and authenticate the user with the NNTP server.

NNTP is described in RFC977

Next