-->
Previous Table of Contents Next


Chapter 30
Accessing the Network with telnet, ftp, and the r- Commands

by Steve Burnett

In this chapter

Using telnet to Access Remote Computers
Using FTP for Remote File Transfer
Using the r- Commands

The major advantage you gain from computer networking is the capability to share resources and information and to access that information from remote locations. Linux provides a robust set of tools for doing just that. Whereas the World Wide Web lets you access lots of information in a hypertext format, additional tools allow you to log in to remote computers, transfer files, and execute remote commands.

Using telnet to Access Remote Computers

The telnet command is the basic tool for remote login under Linux. telnet gives you a terminal session on the remote computer that allows you to execute commands as though you were logged in locally.

To log in to a computer via telnet, you must know a valid username and password on the remote machine. Although some systems do provide guest login capabilities, such capabilities are fairly rare due to security concerns. When guest logins are allowed, they almost always place users in a restricted shell or in a menu system. The idea behind these two guest environments is to provide computer security and protect the system from malicious or careless unknown users. A restricted shell prevents the user from executing specific commands; a menu system allows choices from a predefined set of menus only, blocking out shell access entirely.

telnet also allows users to log in to their own computer from a remote location by entering their username and password. This way, users can check e-mail, edit files, and run programs on their normal computer as though they were logged in locally. However, you have to make do with a terminal-based environment instead of the X Windows system. telnet provides only terminal emulation for common terminals such as the DEC VT-100, which doesn’t support graphical environments such as X Windows.

telnet Command Summary

The basic syntax for telnet is as follows:


telnet [hostname]

hostname is the name of a remote computer. If you don’t specify a remote host, telnet starts in its interactive command mode. If you give a remote host name, telnet tries to initiate a session immediately.

telnet accepts several command-line arguments, as listed in Table 30.1.

Table 30.1 Command-Line Arguments for the telnet Command

Argument Description

-d Turns on debugging.
-a Attempts automatic login.
-n tracefile Turns on tracing and saves trace data in tracefile.
-e escape_char Sets the escape character for the session to be escape_char. If the escape_char character is omitted from the argument, there is no escape character for this telnet session.
-l user Sends the username user to the remote system for automatic login. This argument automatically includes the -a argument.
port Indicates the port number to connect to on the remote system. This argument is used for specifying different network programs. If it’s not specified, telnet connects to the default telnet port.

Sample telnet Session

It’s time to take a walk through a sample telnet session. You start the telnet session by typing telnet, followed by the host name of the computer you want to connect to. telnet then returns with the message Trying some IP address (where some IP address is the address of the computer you specified). If telnet successfully connects to the computer (that is, the computer is up and running and the network isn’t down), Linux reports Connected to computer name and then tells you that the escape character is some specific character sequence, almost always <Ctrl-]>. The escape character specifies the character sequence that you type to drop from your terminal session into the telnet command interpreter. You do this if you want to send commands directly to the telnet program and not to your remote computer session.


Previous Table of Contents Next