[CentOS] connecting linux console using serial port

Fri Aug 18 19:41:00 UTC 2006
pctech at mybellybutton.com <pctech at mybellybutton.com>

>Quoting israel.garcia at cimex.com.cu:
>
>> Hi, I have a serial modem connected to /dev/ttyS0 on my CentOS server, I
>> want to set up this server to allow connections through this serial
>> modem but only to the console.... (I want to log in)...
>>
>> PS: I don't want PPP, I just want to get my linux console through this
>> serial modem...
>>
>> What do I have to configure on my linux?
>
>Hmmm...  Do you want *console* (as in /dev/console) or just terminal  
>access (as in /dev/ttySO)?
>

The easy way is to configure the modem so that it is in Auto-Answer mode all of the time.  Once it is in auto-answer mode it will answer when you dial it and then you will see what the is transmitted to it via the serial cable.  Then follow the instructions for setting up Linux to use the serial port for output/input.  If you don't have that information at your fingertips it is as follows:

2.3	Configuring Headless Operation
By configuring “headless” operating we will be able to manage the system via a cable plugged into the serial port of the system.  This obviates the need to plug a keyboard and monitor into it to perform changes.  Thus the term “headless”.
2.3.1	Changes to /etc/inittab
The /etc/inittab file contains settings that get applied to the Operating Systems at boot time.  There are some changes that need to be made to these settings.  In order to edit the /etc/inittab file type:

vi /etc/inittab

Typing this command will open the /etc/inittab file for editing.

As stated earlier the 18th line down is the run level line. Add the following line to the file:

S0:12345:respawn:/sbin/agetty 9600 linux

This line sets the Operating System to be able to send boot time information to the serial port in addition to the console.

After you have made these changes to the /etc/inittab file press the colon (: ) key and then type wq to quit vi and save the changes.

2.3.2	Changes to /etc/securetty
The /etc/securetty sets the controls for which TTY devices that the root account can log on via.  In order for us to be able to log onto the serial console as root or to be able to su to root we must add a line to the file.  In order to edit the /etc/secuertty file type:

vi /etc/securetty

Typing this command will open the /etc/secuertty file for editing.

Add the following line to the end of the file:

ttyS0

This line sets the Operating System to allow root to log on to the serial port in addition to the console.

After you have made these changes to the /etc/securetty file press the colon (: ) key and then type wq to quit vi and save the changes.

2.3.3	Changes to the Boot Loader
In order for boot-time messages to be sent to the console, including the boot loader information some changes must be made to the configuration file for it.  The boot loader that CentOS uses is GRUB.  As such, the configuration file is /etc/grub.conf.

The first change that we must make is to add some lines after the timeout line in the GRUB configuration file.  In order to edit the /etc/grub.conf file type:

vi /etc/grub.conf

Typing this command will open the /etc/grub.conf file for editing.

Add the following two lines after the timeout line in the configuration file:

serial --unit=0 --speed=9600
terminal --timeout=5 serial console
Another change that we must make in the GRUB configuration file is to tell the kernel to send out all kernel-level messages to the serial port in addition to the console.  That is done by adding the following line to the end of the kernel line:

console=tty1 console=ttyS0

After you have made these changes to the /etc/grub.conf file press the colon (: ) key and then type wq to quit vi and save the changes.

Once you have made these changes reboot the system by typing by typing:

reboot

The system will now reboot.


>-- 
>NOTICE: If you are not intended recipient, you are hereby notified
>that by reading this message you agreed not to disturb frogs during
>mating season.  For more info, visit http://www.8-P.ca/
>
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>http://lists.centos.org/mailman/listinfo/centos