[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


telnet, tn, or tn3270 Command

Purpose

Connects the local host with a remote host, using the Telnet interface.

Syntax

{ telnet | tn | tn3270 } [ -d ] [ -p ] [ -n TraceFile ] [ -e TerminalType ] [ -f | -F ] [ -k realm ] [ -l user ] [ Host [ Port ] ]

Description

The telnet command, which is also referred to as the tn or tn3270 command, operates in two different modes: command mode and input mode.

Command Mode

When the telnet command is issued without arguments, it enters command mode, as indicated by the telnet>, tn>, or the tn3270> prompt. A user can also enter command mode from input mode by pressing Ctrl-] for the telnet command, Ctrl-T for the tn command, or Ctrl-C for the tn3270 command. In command mode, subcommands can be entered to manage the remote system. Some of these subcommands return you to the remote session upon completion. For those subcommands that do not, pressing the Enter key returns you to the remote session.

Note: The default escape sequence for this command is Ctrl-] for the telnet command, Ctrl-T for the tn command, or Ctrl-C for the tn3270 command. This default can be overridden by changing the TNESC environment variable.

To enter telnet command mode while connected to a remote host, type the Telnet escape key sequence. When in command mode, the standard operating system editing conventions, such as backspace, are available.

Input Mode

When the telnet command is issued with arguments, it performs an open subcommand with those arguments and then enters input mode. The type of input mode is either character-at-a-time or line-by-line, depending on what the remote system supports. In character-at-a-time mode, most text that is typed is immediately sent to the remote host for processing. In line-by-line mode, all text is echoed locally and completed lines are sent to the remote host.

In either input mode, if the toggle localchars subcommand has a value of True, the user's QUIT, INTR, and FLUSH characters are trapped locally and sent as Telnet Protocol sequences to the remote host. The toggle autoflush and toggle autosynch subcommands cause this action to flush subsequent output to the terminal until the remote host acknowledges the Telnet sequence and to flush previous terminal input (in the case of QUIT and INTR characters).

Arabic/Hebrew Support

The telnet, tn, and tn3270 command supports the Arabic and Hebrew texts, allowing the user to type Arabic or Hebrew characters while in an emulation session. The Ar_AA locale displays the Arabic characters in their correct shapes. The following functions support the bidirectional Arabic and Hebrew texts:

Language Selection

This function allows you to toggle the language layer. Activate the Arabic/Hebrew language selection with the following key combinations:

Alt+N From an AIX terminal
Esc+N From an ASCII terminal
Alt+N or Esc+N From a Latin AIX terminal

Activate the Latin language layer with the following key combinations:

Alt+L From an Arabic or Hebrew AIX terminal
Esc+L From an ASCII terminal
Alt+L or Esc+L From an AIX terminal

Screen Reverse

This function reverses the screen image and invokes the default language of the new screen orientation. Thus, if the screen is reversed to right-to-left, the language is changed to Arabic/Hebrew. If the screen is reversed to left-to-right, the language is changed to Latin.

If symmetric character swapping is enabled, reversing the screen causes bidirectional characters to be replaced by their counterparts. For example, if numeric character swapping is enabled, reversing the screen causes Hindi numerals to be replaced by their Arabic counterparts and the Arabic numerals to be replaced by their Hindi counterparts.

Activate screen reverse with the following key combinations:

Alt+S From an Arabic or Hebrew AIX terminal
Esc+S From an ASCII terminal
Alt+S or Esc+S From a Latin AIX terminal

Push/End Push

The Push function allows you to edit text whose direction is opposite the screen orientation. When you activate this function, the cursor orientation is reversed, the language layer is changed accordingly, and a Push segment is created.

The Push function has two secondary modes:

Boundary Mode This mode is activated upon entering the Push mode. In this mode, the cursor remains in its position while you type additional characters. The text is pushed in the opposite direction of the screen orientation.
Edit Mode This mode is activated when the cursor is moved from its boundary position into the Push segment area. In this mode, you can edit the text within the Push segment, while typing in the field's natural direction.

Activate this function with the following key combinations:

Alt+P From an Arabic or Hebrew AIX terminal
Esc+P From an ASCII terminal
Alt+P or Esc+P From a Latin AIX terminal

The End Push function terminates the Push function. The cursor jumps to the end of the Push segment and its direction changes to the original direction. You can activate End Push by pressing any field exit keys such as cursor up, cursor down, or any attention identifier (AID) key such as the Enter key. You can also activate this function with the following key combinations:

Alt+E From an Arabic or Hebrew AIX terminal
Esc+E From an ASCII terminal
Alt+E or Esc+E From a Latin AIX terminal

Field Reverse

This function toggles the field orientation to either the opposite of or the same as the screen orientation. This function does not invert the text in the field. The cursor orientation is set to the new field orientation and the language layer is selected accordingly.

For example, if the cursor is in the first logical position of a field or line when you activate the field reverse function, the cursor skips to the opposite side of that field or line. This position is now the first logical position. If the cursor is not in the first position of the field or line when you activate field reverse function, the cursor remains in its position and allows natural and correct editing of the existing text. Activate this function with the following key combinations:

Alt+R From an Arabic or Hebrew AIX terminal
Esc+R From an ASCII terminal
Alt+R or Esc+R From a Latin AIX terminal

Autopush

This function assists you in typing mixed left-to-right and right-to-left text. When enabled, reversed segments are automatically initiated and terminated according to the typed characters or the selected language layer. Thus, this mode automatically invokes the Push mode and relieves you of invoking the Push function.

When you type a digit or Latin character in a right-to-left field, the Autopush function automatically initiates the Push function without changing the language. If you type additional digits or Latin character, the Push function continues; otherwise, the Push function automatically terminates. Thus, you can type Arabic/Hebrew text with embedded digits or Latin characters without invoking the Push/End Push functions.

When you type an Arabic/Hebrew character in a left-to-right field, the Autopush function automatically initiates the Push function without a language change. If you then type a digit or Latin character, the Autopush function automatically terminates. Thus, you can type Latin text with embedded Arabic/Hebrew text using the Language Selection function rather than the Push/End Push functions.

Activate this function with the following key combinations:

Alt+A From an Arabic or Hebrew AIX terminal
Esc+A From an ASCII terminal
Alt+A or Esc+A From a Latin AIX terminal

Field Shape

This function shapes the Arabic characters in the current field or line. Activate this function with the following key combinations:

Alt+H From an Arabic AIX terminal
Esc+H From an ASCII terminal
Alt+H or Esc+H From a Latin AIX terminal

Field Deshape

This function deshapes Arabic text in the current field or line. Activate this function with the following key combinations:

Alt+B From an Arabic AIX terminal
Esc+B From an ASCII terminal
Alt+B or Esc+B From a Latin AIX terminal

Contextual Shape Determination

This function determines the shape of an Arabic character based on the surrounding text. Use the Contextual Shape Determination function only when typing or editing right-to-left text. This function is terminated when any of the specific shape selection keys is pressed. This is the default function. Activate this function with the following key combinations:

Alt+C From an Arabic AIX terminal
Esc+C From an ASCII terminal
Alt+C or Esc+C From a Latin AIX terminal

Initial Shape Determination

This function shapes Arabic characters in their initial shapes. Activate this function with the following key combinations:

Alt+I From an Arabic AIX terminal
Esc+I From an ASCII terminal
Alt+I or Esc+I From a Latin AIX terminal

Middle Shape Determination

This function shapes Arabic characters in their middle shapes. Activate this function with the following key combinations:

Alt+M From an Arabic AIX terminal
Esc+M From an ASCII terminal
Alt+M or Esc+M From a Latin AIX terminal

Isolated Shape Determination

This function shapes Arabic characters in their isolated shapes. Activate this function with the following key combinations:

Alt+O From an Arabic AIX terminal
Esc+O From an ASCII terminal
Alt+O or Esc+O From a Latin AIX terminal

Final Shape Determination

This function shapes Arabic characters in their final shapes. Activate this function with the following key combinations:

Alt+Y From an Arabic AIX terminal
Esc+Y From an ASCII terminal
Alt+Y or Esc+Y From a AIX terminal

Miscellaneous Functions

To activate numeric swapping, type the following line at the command line:

export ARB_NUM_SWAP=1 

To activate symmetric swapping, that is, to swap bidirectional characters such as braces, brackets, and so on, type the following line at the command line:

export ARB_SYM_SWAP=1

To specify the code page that the host uses, type the following line at the command line:

export RM_HOST_LANG=IBM-420

Terminal Type Negotiation

The telnet command negotiates the terminal type, using the Telnet protocol, and it sets the TERM environment variable according to what has been negotiated.

To override the terminal negotiation from the console, use the EMULATE environment variable or the -e flag; or invoke the tn3270 command if you require 3270 emulation. To determine whether terminal-type negotiation is performed, the following list describes the order of the telnet command processing:

  1. The -e command-line flag. (No negotiation.)
  2. The EMULATE environment variable. (No negotiation.)
  3. The tn3270 command. (No negotiation.)
  4. If steps 1, 2, and 3 are not present, terminal-type negotiation occurs automatically.

If the client and the server negotiate to use a 3270 data stream, the keyboard mapping is determined by the following precedence:

$HOME/.3270keys Specifies the user's 3270 keyboard mapping when the tn or telnet command is invoked. If you are using a color display, you can also change this file to customize the colors for 3270 displays.
/etc/map3270 Specifies the user's 3270 keyboard mapping when the tn3270 command is invoked. The /etc/map3270 file defines keyboard mapping and colors for the tn3270 command.
/etc/3270.keys Specifies the base 3270 keyboard mapping for use with limited function terminals.

Secure Attention Key (SAK) Option

In addition to terminal negotiation, the telnet command allows negotiation for the Secure Attention Key (SAK) option. This option, when supported, provides the local user with a secure communication path to the remote host for tasks such as changing user IDs or passwords. If the remote host supports the SAK function, a trusted shell is opened on the remote host when the telnet send sak subcommand is issued. The SAK function can also be assigned to a single key available in telnet input mode, using the set sak subcommand.

End-of-Line Convention

The Telnet protocol defines the carriage-return line-feed (CR-LF) sequence to mean "end-of-line." For terminal input, this corresponds to a command-completion or end-of-line key being pressed on a user terminal. On an ASCII terminal, this is the CR key, but it may also be labeled "Return" or "Enter."

When a Telnet server receives the Telnet end-of-line sequence, CR-LF, as input from a remote terminal, the effect is the same as if the user had pressed the end-of-line key on a local terminal.

On ASCII servers, receiving the Telnet sequence CR-LF causes the same effect as a local user pressing the CR key on a local terminal. CR-LF and CR-NUL have the same effect on an ASCII server when received as input over a Telnet connection.

Note: A Telnet user must be able to send CR-LF, CR-NULL, or LF. An ASCII user must be able to send CR-LF or CR-NULL.

A Telnet user on an ASCII host should have a user-controllable mode to send either CR-LF or CR-NULL when the user presses the end-of-line key. The CR-LF should be the default. The Telnet end-of-line sequence, CR-LF, must be used to send Telnet data that is not terminal-to-computer. This occurs, for example, when a Telnet server sends output or when the Telnet protocol incorporates another application protocol.

The telnet command "execs" (using the exec command) the /usr/sbin/login command to validate a user. This 1) allows all user and device attributes to take effect on telnet connections and 2) causes telnet connections to count against the maximum number of login sessions allowable at a time (determined by the maxlogins attribute). Attributes are defined in the /etc/security/user and /etc/security/login.cfg files.

Restrictions

Environment Variables

The following environment variables can be used with the telnet command:

EMULATE Overrides terminal-type negotiation in the same way as the -e flag. If the value of the EMULATE environment variable is defined as vt100 or 3270, the telnet command emulates a DEC VT100 terminal or 3270 terminal, respectively. If the EMULATE variable is not defined or has a value of none, the telnet command operates normally. If the EMULATE variable is set to vt100 or 3270, the TERM environment variable in the remote login connection should be set to the same value. You can check this by using the env command after the connection is open.
TNESC Specifies an alternate TELNET escape character, other than the default, Ctrl-] for the telnet command, Ctrl-T for the tn command, or Ctrl-C for the tn3270 command. To change the telnet escape sequence, set TNESC to the octal value of the character you want to use. Then export TNESC. For example, set TNESC to 35 to change the TELNET escape sequence to Ctrl-].
MAP3270 Specifies an alternate file that contains the user's 3270 keyboard mapping. The MAP3270 variable must contain the full path name to the alternate file. Create the alternate file using the same format as the default /etc/map3270 file.
RM_HOST_LANG Specifies the EBCDIC code page being used on the remote 3270 host. Set the RM_HOST_LANG environment variable to the correct code page before you telnet (using the telnet command) to a non-English-speaking 3270 host. The default is English. Refer to the List of Converters in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs for possible code pages to use. Format the RM_HOST_LANG environment variable by specifying the desired code page.

The telnet command converts characters by using the iconv command. Users can change the default conversion tables by using the genxlt command.

Flags


-d Turns debugging mode on.
-e TerminalType Overrides terminal-type negotiation. Possible values are vt100, 3270, or none.
-n TraceFile Records network trace information in the file specified by the TraceFile variable.
-p Preserves current tty attributes.
-f Causes the credentials to be forwarded. This flag will be ignored if Kerberos 5 is not the current authentication method. Authentication will fail if the current DCE credentials are not marked forwardable.
-F Causes the credentials to be forwarded. In addition, the credentials on the remote system will be marked forwardable (allowing them to be passed to another remote system). This flag will be ignored if Kerberos 5 is not the current authentication method. Authentication will fail if the current DCE credentials are not marked forwardable.
-k realm Allows the user to specify the realm of the remote station if it is different from the local systems realm. For these purposes, a realm is synonymous with a DCE cell. This flag will be ignored if Kerberos 5 is not the current authentication method.
-l user Specifies the remote user the telnet wants to login as. This option is ignored if Kerberos 5 is not the current authentication method.

Subcommands

Before entering each subcommand, press the escape key sequence. The escape sequence tells the program that non-text information follows. Otherwise, the program interprets subcommands as text.

For each of the subcommands in the following list, you only need to type enough letters to uniquely identify the subcommand. (For example, q is sufficient for the quit subcommand.) This is also true for the arguments to the display, emulate, mode, set, and toggle subcommands.

The telnet subcommands are:

? [Subcommand] Requests help on telnet subcommands. Without arguments, the ? subcommand prints a help summary. If a Subcommand variable is specified, help information is displayed for that subcommand.
close Closes the TELNET connection and returns to telnet command mode when the open subcommand is used to establish the connection. When the telnet command is invoked and a host is specified, the close subcommand closes the TELNET connection and exits the telnet program (identical to the quit subcommand).
display [Argument] Displays all of the set and toggle values if no Argument variable is specified; otherwise, lists only those values that match the Argument variable.
emulate TerminalType Overrides terminal-type negotiation with the specified terminal type. Possible choices are:

?
Prints help information.

3270
Emulates a 3270 terminal.

none
Specifies no emulation.
vt100 Emulates a DEC VT100 terminal.

All output received from the remote host is processed by the specified emulator. The initial terminal type to emulate can be specified through the EMULATE environment variable or the -e flag to the telnet command.

Note: Only standard ASCII characters are allowed in emulation mode.

mode Type Specifies the current input mode. When the Type variable has a value of line, the mode is line-by-line. When the Type variable has a value of character, the mode is character-at-a-time. Permission is requested from the remote host before entering the requested mode, and if the remote host supports it, the new mode is entered.
open Host [Port] Opens a connection to the specified host. The Host specification can be either a host name or an Internet address in dotted-decimal form. If no Port variable is specified, the telnet subcommand attempts to contact a TELNET server at the default port.
quit Closes a TELNET connection and exits the telnet program. A Ctrl-D in command mode also closes the connection and exits.
send Arguments Sends one or more arguments (special character sequences) to the remote host. Multiple arguments are separated by spaces. The following arguments can be used:

?
Prints help information for the send subcommand.

ao
Sends the TELNET AO (Abort Output) sequence, which causes the remote host to flush all output from the remote system to the local terminal.

ayt
Sends the TELNET AYT (Are You There) sequence, to which the remote system can respond.

brk
Sends the TELNET BRK (Break) sequence, which causes the remote system to perform a kill operation.

ec
Sends the TELNET EC (Erase Character) sequence, which causes the remote host to erase the last character entered.

el
Sends the TELNET EL (Erase Line) sequence, which causes the remote system to erase the line currently being entered.

escape
Sends the current telnet escape character. The default escape sequence is Ctrl-] for the telnet command, Ctrl-T for the tn command, or Ctrl-C for the tn3270 command.

ga
Sends the TELNET GA (Go Ahead) sequence, which provides the remote system with a mechanism to signal the local system to return control to the user.

ip
Sends the TELNET IP (Interrupt Process) sequence, which causes the remote system to cancel the currently running process.

nop
Sends the TELNET NOP (No Operation) sequence.

sak
Sends the TELNET SAK (Secure Attention Key) sequence, which causes the remote system to invoke the trusted shell. If the SAK is not supported, then an error message is displayed that reads: Remote side does not support SAK.

synch
Sends the TELNET SYNC sequence, which causes the remote system to discard all previously typed input that has not yet been read. This sequence is sent as TCP/IP urgent data.
set VariableValue Sets the specified TELNET variable to the specified value. The special value off turns off the function associated with the variable entered. The display subcommand can be used to query the current setting of each variable. The variables that can be specified are:

echo
Toggles between local echo of entered characters and suppressing local echo. Local echo is used for normal processing, while suppressing the echo is convenient for entering text that should not be displayed on the screen, such as passwords. This variable can only be used in line-by-line mode.

eof
Defines the character for the telnet command. When the telnet command is in line-by-line mode, entering the eof character as the first character on a line sends the character to the remote host. The initial value for the eof character is the local terminal End-Of-File character.

erase
Defines the erase character for the telnet command. When the telnet command is in character-at-a-time mode and localchars has a value of true, typing the erase character sends the TELNET EC sequence to the remote host. The initial value for the erase character is the local terminal ERASE character.

escape
Specifies the telnet escape character, which puts the telnet command into command mode when connected to a remote host. This character can also be specified in octal in the TNESC environment variable.

flushoutput
Defines the flush character for the telnet command. When localchars has a value of true, typing the flushoutput character sends the TELNET AO sequence to the remote host. The initial value for the flush character is Ctrl-O. If the remote host is running AIX, the flushoutput variable, unlike the other special characters defined by the set subcommand, only works in localchars mode since it has no termio equivalent.

interrupt
Defines the interrupt character for the telnet command. When localchars has a value of true, typing the interrupt character sends the TELNET IP sequence to the remote host. The initial value for the interrupt character is the local terminal interrupt (INTR) character.

kill
Defines the kill character for the telnet command. When the telnet command is in character-at-a-time mode and localchars has a value of true, typing the kill character sends the TELNET EL sequence to the remote host. The initial value for the kill character is the local terminal KILL character.

quit
Defines the quit character for the telnet command. When localchars has a value of true, typing the quit character sends the TELNET BRK sequence to the remote host. The initial value for the quit character is the local terminal QUIT character.

sak
Defines the Secure Attention Key (SAK) for the telnet command. When the sak character is entered, the remote system is asked to create a trusted shell. If the remote host does not support the SAK, this sequence has no effect.

status
Shows the status of the telnet command, including the current mode and the currently connected remote host.
toggle Arguments Toggles one or more arguments that control how the telnet command responds to events. Possible values are true and false. Multiple arguments are separated by spaces. The display subcommand can be used to query the current setting of each argument. The following arguments can be used:

?
Displays valid arguments to toggle.

autoflush
If autoflush and localchars both have a value of true and the AO, INTR, and QUIT characters are recognized and transformed into TELNET sequences, the telnet command does not display any data on the user's terminal until the remote system acknowledges (with a TELNET timing mark option) that it has processed those TELNET sequences. The initial value of autoflush is true if the terminal has not done an stty noflsh, and false if it has.

autosynch
If autosynch and localchars are both true, then typing the INTR or QUIT character sends that character's TELNET sequence, followed by the TELNET SYNC sequence. This procedure causes the remote host to discard all previously typed input until both of the TELNET sequences have been read and acted upon. The initial value of this toggle is false.

crmod
Toggles carriage return mode. When set to true, most carriage return characters received from the remote host are mapped into a carriage return followed by a line feed. This mode does not affect the characters typed by the user, only those received from the remote host. This mode is useful when the remote host sends only a carriage return and not a line feed. The initial value of this toggle is false.

debug
Toggles debugging at the socket level. The initial value of this toggle is false.

localchars
Determines the handling of TELNET special characters. When this value is true, the ERASE, FLUSH, INTERRUPT, KILL, and QUIT characters are recognized locally and transformed into the appropriate TELNET control sequences (EC, AO, IP, BRK, and EL, respectively). When this value is false, these special characters are sent to the remote host as literal characters. The initial value of localchars is true in line-by-line mode and false in character-at-a-time mode.

netdata
Toggles the display of all network data (in hexadecimal format). The data is written to standard output unless a TraceFile value is specified with the -n flag on the telnet command line. The initial value of this toggle is false.

options
Toggles the display of internal TELNET Protocol processing options, such as terminal negotiation and local or remote echo of characters. The initial value of this toggle is false, indicating that the current options should not be displayed.

lineterm
Toggles the default end-of-line terminator to CR-LF (ASCII carriage-return line-feed). A telnet client running on an ASCII host should have the user configurable option to send either the CR-NUL or CR-LF terminator when the user presses the end-of-line key. The initial value of this toggle is false.
z Suspends the TELNET process. To return to the TELNET process, use the fg built-in command of the csh or ksh command.

Note: The z subcommand has the same effect as a Ctrl-Z key sequence for any other process. It suspends Telnet execution and returns you to your original login shell.

Authentication

If the system is configured for Kerberos 5 authentication, the telnet client will attempt authentication negotiation. The authentication negotiation used by telnet and the definitions of the options and suboptions for this are defined in rfc 1416.

If the client and server agree on an authentication type, they will exchange authentication information including the account the client wants to access. This will be the local user unless the -l flag is set.

If they cannot agree on the authentication information or if it fails, the telnet connection will continue with the standard connection (provided Standard AIX is configured).

The remote host allows access only if all of the following conditions are satisfied:

Examples

In the following examples, if you enter the tn command instead of the telnet command, the command mode prompt is displayed as tn>.

  1. To log in to the remote host host1 and perform terminal negotiation, enter:

    telnet host1
    
  2. To log in to host1 as a vt100 terminal (no terminal type negotiation), choose one of the following methods:
    1. Use the following commands to set the EMULATE environment variable for this login session, then enter the telnet command:
      EMULATE=vt100; export EMULATE
      telnet host1

    2. Use the -e flag to set the terminal type for this telnet session only:
      telnet  -e vt100 host1
  3. To log in to a remote host and then check the status of the telnet program, enter:

    telnet host3
    

    When the login prompt appears, enter your login ID and password. Press the Ctrl-T key sequence to receive the telnet> prompt. Enter the following at the telnet> prompt:
    status

    Information similar to the following is displayed on your screen:

    Connected to host3.
    Operating in character-at-a-time mode.
    Escape character is '^]'.
    

    Upon completion of the status subcommand, press the Enter key to return to the remote prompt.

    Once you have completed your login, you can issue commands. To log out of the system and close the connection, press the Ctrl-D key sequence, or exit.

  4. To log in to a remote host using the tn3270 command, enter:

    tn3270 hostname
    

    The host login screen should be displayed. You can now enter your login ID and password. Once you have completed your login, you can issue commands. To log out of the system and close the connection, press Ctrl-D or exit.

Files


/etc/3270.keys Defines base 3270-keyboard mapping for use with limited function terminals.

Related Information

The env command, ftp command, login command, rcp command, rexec command, rlogin command, rsh command.

The telnetd daemon.

The kvalid_user function.

The map3270 file format, .3270keys file format.

Network Overview in AIX 5L Version 5.1 System User's Guide: Communications and Networks.

Connecting a Local Host to a Remote Host in AIX 5L Version 5.1 System User's Guide: Communications and Networks.

Secure Rcmds in AIX 5L Version 5.1 System User's Guide: Communications and Networks.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]