Web linux-server.50webs.com

Linux Server Basics

Connecting through the Serial Interface:

Regardless of whether data comes through a modem or from a directly attached terminal, it is handled by the Linux system in the same way. Three programs handle the connection: init, getty, and login. init is responsible for attaching the getty program to a serial port and for restarting the getty program whenever it terminates.

getty monitors the serial port. When getty detects a carrier signal on the port, it displays the login: prompt. It reads in the user's name and uses it to invoke login. For example if getty received norman in response to the login prompt, it would issue the command login norman.

login then prompts the user for a password, and checks the password using the appropriate authentication scheme. One of a number of schemes can be selected during the initial installation. For example, the password might be checked against the encrypted password in the /etc/passwd or /etc/shadow file. The Linux user is given a few tries to enter the correct password. After the password is verified as correct, the UID and GID associated with the username are assigned to the tty device, and the following environment variables are set:

  • HOME: This variable defines the user's home directory. login takes the value from the /etc/passwd file.
  • SHELL: This variable defines the user's login shell. login takes the value from the /etc/passwd file.
  • LOGNAME: This variable defines the name by which the user is identified in the system log. login uses the username passed to it by getty.
  • PATH: This variable defines the execution path. login defaults to a path of /usr/local/bin:/ bin:/usr/bin.
  • Mail: This variable defines the path to the user's mail file. login uses the path /var/mail/spool/username, where username is the name passed to login by getty.
  • TREM: This variable identifies the terminal type. login keeps the TERM environment variable set by getty. The value of TERM will be a valid terminal type from the /etc/termcap file.

After these variables are set, login starts the shell identified in the user's /etc/passwd entry. The shell processes the initialization files that it finds in the user's home directory. These initialization files, such as .bash_profile and .bashrc for the bash shell, permit users to set their own environment variables; for example, to define a more complete execution path. Finally, the shell issues the command prompt to the user, and the user has access to the system.

All of these processes and services happen automatically and require almost no configuration on your part beyond creating a user account for the user and configuring the modem to answer the telephone. The basic Linux system comes with the capability to support terminal connections through serial ports. If you have ever configured dial-up services on other PC operating systems, you'll appreciate what an advantage this is.

Of course, even on a Linux system, things don't always work smoothly. Linux comes with some terminal-emulation programs such as seyon and minicom that can be used to troubleshoot modems and serial links.

The support for serial communications that is built into Linux is the foundation for running TCP/ IP over a serial line. The next section covers just that.

.