• Top
  • Reply

Using Serial to login to shell in Fedora 13+

So you want to now connect to your computer using a serial port, most of the tutorials out there tell you to add a simple line and your serial connection should work. Well this is not the case, not for fedora 13+ any way.

To do this im using a computer with a serial port in the back. If your computer doesn't have a serial port built in you can buy them in PCI cards and install them on Fedora. Secondly you require a serial cable, Im using USB to Serial to make my life easier. And lastly you require a terminal, Im using Putty.

Simple Step List

  1. Check which device to connect to
  2. Create a file in /etc/init/
  3. Write our script

Now you are set to do some config changes. On the server type the following command:

 dmesg | grep tty

This command just finds all the devices attached and returns devices that start with tty

On my server here is my output

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

The key thing to note here is ttyS0 if your computer has more than one port you will have another entry for ttyS1 and so on.

Now we know which device we need to be editing, we now create a file in /etc/init/ directory and call it serial-ttyS0.conf

And simply the contents of this file are as such

#This service maintains a getty on /dev/ttyS0.

start on stopped rc RUNLEVEL=[2345]
stop on starting runlevel [016]

exec /sbin/agetty /dev/ttyS0 9600 vt100-nav

The start and stop lines define which run level will this be accessible

You can look up more agetty commands to get a better understanding of the options you can choose. However the above command is simply

exec /sbin/agetty <deviceIdentifier> <Rate BPS> <TerminalEmulator>

You should now start putty and set try connecting. Note to self, you need to press the enter key before the prompt shows up

However your serial works but you cant login as root. This is just extra security or shall I say securetty. You need to allow root to be accessible using serial to achieve this edit /etc/securetty and add ttyS0 at the end of the file. This allows root to be accessible from Serial0.

Please do look at the below links to understand the configuration in details


9th Apr 2011
© 2011 Shahmir Javaid - http://shahmirj.com/blog/13

Back to Top
All content is © copyrighted, unless stated otherwise.
Subscribe, @shahmirj, Shahmir Javaid+