Previous | Table of Contents | Next |
Terminal Emulation Using telnet
The rlogin command allows for a connection from one system to another. rlogin, however, requires the user to have an account on the remote machine and host equivalency to have been configured. telnet, on the other hand, does not need either of those things.
The telnet command uses the TELNET protocol to establish a connection from the client to a telnetd server on the remote system. Unlike rlogin, telnet has a host mode where it is connected to the remote system, and command mode where the user can enter commands and interact with the TELNET protocol to change how the connection is handled.
To create a telnet connection, the user enters the telnet command, with or without a hostname. When telnet is started with a hostname, a connection to the remote host is established. After the connection is established, the user must then provide a login name and password to access the remote system. This is illustrated in the following:
$ telnet chelsea Trying 198.73.138.6... Connected to chelsea.widgets.ca. Escape character is ^]. SunOS Unix(chelsea.widgets.ca) login: chare Password: Last login: Mon Oct 10 17:33:35 from oreo.widgets.ca SunOS Release 4.1 (GENERIC) #1: Wed Mar 7 10:59:35 PST 1990 %
Command mode is entered either by starting telnet with no arguments, or by entering Control+], which is the telnet escape key. This control key instructs telnet to enter command mode, as shown here:
chelsea.widgets.ca% telnet> ? Commands may be abbreviated. Commands are: close close current connection logout forcibly log out remote user and ction display display operating parameters mode try to enter line or character mode (mode ? for more) open connect to a site quit exit telnet send transmit special characters (send ? for more) set set operating parameters (set ? for more) unset unset operating parameters (unset ? for more) status print status information toggle toggle operating parameters (toggle ? for more) slc change state of special characters (slc ? for more) z suspend telnet ! invoke a subshell environ change environment variables (environ ? for more) ? print help information telnet>
In the preceding example, the switch to command mode is performed and is indicated by the telnet> prompt. Once in command mode, there are a number of commands that can be used to alter or reconfigure the current session. The actual number of commands available in command mode is far too numerous to be discussed here.
telnet, however, has another useful feature. It is to allow the connection to a specific TCP port on a system, which may or may not be remote. The following example illustrates a connection to the SMTP port, port 25, on the local system:
$ telnet localhost 25 Trying 127.0.0.1... Connected to localhost.widgets.ca. Escape character is ^]. 220 oreo.widgets.ca Server SMTP (Complaints/bugs to: postmaster) helo 250 oreo.widgets.ca - you are a charlatan help 214-The following commands are accepted: 214-helo noop mail data rcpt help quit rset expn vrfy 214- 214 Send complaints/bugs to: postmaster quit 221 oreo.widgets.ca says goodbye to localhost.0.0.127.in-addr.arpa at Mon Oct 10 20:35:24. Connection closed by foreign host. $
Although this is a useful feature to have when debugging connection problems, it also enables a user to forge e-mail by giving it directly to the SMTP or sendmail daemon. Actually, most TCP/IP daemons can be connected to by using telnet with the port number, which might allow for other security mechanisms to be breached, particularly with sendmail.
File Transfers with FTP
FTP is the ARPANET File Transfer Program that uses the File Transfer Protocol to allow for the verified transfer of a file from one PC to another. To reduce the chance of confusion, ftp usually refers to the program, while FTP refers to the protocol that is used to transfer the files.
Previous | Table of Contents | Next |