You can determine whether you have valid serial ports using the setserial command. In this case we are looking for all available ports between ttyS0 to ttyS7. You can see we only have two valid selections, ttyS0 and ttyS1.

[root@bigboy tmp]# setserial -g /dev/ttyS[01234567]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
[root@bigboy tmp]#

To configure both valid COM ports for terminal access, add these lines to /etc/inittab:

# Run COM1 and COM2 gettys in standard runlevels
S0:235:respawn:/sbin/agetty -L 9600 ttyS0 vt102
S1:235:respawn:/sbin/agetty -L 9600 ttyS1 vt102

What do these lines mean? At boot time, when the system enters runlevels 2, 3, or 5, agetty must attach itself to devices ttyS0 and ttyS1 and emulate a VT102 terminal running at 9600 baud. The -L means ignore modem control signals, this option should be omitted if you are connecting the port to a modem. The respawn lines mean that agetty will restart automatically if, for whatever reason, it dies.

The next step is to restart the init process to re-read /etc/inittab:

[root@bigboy tmp]# init q

You’ll be able to verify the activation of agetty process by querying the process table using the ps command.

[root@bigboy tmp]# ps -ef | grep agetty
root  958  1  0 Dec13 ttyS0 00:00:00 /sbin/agetty -L 9600 ttyS0 vt100
root 1427  1  0 Dec13 ttyS1 00:00:00 /sbin/agetty -L 9600 ttyS0 vt100
[root@bigboy tmp]#

Now you need to configure the terminal client (Hyperterm) to match the speed settings in /etc/inittab. Connect the console/modem cable between the client and your Linux box. Press Enter a couple times, and celebrate when you see something like this:

Red Hat Linux release 8.0 (Psyche)
Kernel 2.4.18-14 on an i586

bigboy login:

Note: By default, user root will not be able to log in from a terminal. To do this, you’ll have to edit the /etc/securetty file, which contains the device names of TTY lines on which root is allowed to login. Just add ttyS0 and ttyS1 to the list if you need this access.

Post By Editor (2,827 Posts)

Website: →