You have a Linux laptop or workstation all ready to go into service as a serial console; all you need to know is how to configure it, and how to use the communications software. You want to connect directly to your headless server.
First, you need these things:
A DB9 serial port. A lot of laptops don't have serial ports. An alternative is a USB-to-serial connector.
Null modem cable.
Minicom, the serial communications program.
Then, configure Minicom, connect the two systems, and you're done.
Start up Minicom with -s
for
Setup:
# minicom -s
------[configuration]------
| Filenames and paths
| File transfer protocols
| Serial port setup
| Modem and dialing
| Screen and keyboard
| Save setup as dfl
| Save setup as..
| Exit
| Exit from Minicom
----------------------------
Select Serial port setup
.
From the following menu, select the letter of the option you want to
change, then hit Return to get back to the "Change which setting?" screen:
------------------------------------------ | A - Serial Device : /dev/ttyS0 | B - Lockfile Location : /var/lock | C - Callin Program : | D - Callout Program : | E - Bps/Par/Bits : 9600 8N1 | F - Hardware Flow Control : Yes | G - Software Flow Control : No | | Change which setting? -------------------------------------------
From here, hit Return again to get back to the main menu. Next,
select the Modem and dialing
option, and make sure the Init
string
and Reset string
settings are blank. Finally, select Save
setup as dfl
to make this the default, and then Exit from Minicom
.
Now, take your nice new null-modem cable, and connect the two machines. Then, fire up Minicom:
# minicom
Welcome to minicom 2.1
OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Nov 12 2003, 19:21:57
Press CTRL-A Z for help on special keys
headless login:
Login to your server, and you're in business. To exit, hit Ctrl-A, X.
What can you do now? Anything that you can do from any Linux command shell. Now you can disconnect the keyboard and monitor from the server. Always turn computers off before connecting or disconnecting PS/2 keyboards and mice. I know, some folks say you don't have to turn off the power before removing PS/2 keyboards and mice. I say it's cheap insurance against possibly damaging your system; the PS/2 port was not designed to be hot-pluggable.
The default Bps value for option E -
Bps/Par/Bits
in the Minicom setup can be anything from 9600
to 115200, depending on your Linux distribution. The Bps setting, when
you're connecting with a null modem cable, must be the same throughout
all of your configurations—in the bootloader,
/etc/inittab, and Minicom. 9600 is the safest.
You can experiment with higher speeds: 38400 is the standard Linux
console speed. If it doesn't work, try 19200.
The setserial command displays the speed of your UART:
$ setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
But, it's unlikely you'll successfully go higher than 38400. These are all the possible serial line speeds:
110 bps |
300 bps |
1200 bps |
2400 bps |
4800 bps |
9600 bps |
19,200 bps |
38,400 bps |
57,600 bps |
115,200 bps |
File permissions can drive you a bit nuts. If the server won't let you log in as root, you need an entry in /etc/securetty on the server:
# /etc/securetty: list of terminals on which root is allowed to login. # See securetty(5) and login(1). console # for people with serial port consoles ttyS0
If you cannot connect as an unprivileged user, it means /dev/ttyS0 is restricted to the root user. First, check permissions and ownership:
$ ls -al /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 Sep 7 22:22 /dev/ttyS0
/dev/ttyS0 is owned by the dialout group, so all you need to do is add your authorized users to that group.
Some how-tos tell you to make /dev/ttyS0 mode 777, which from a security stand-point isn't a good idea. It's not much trouble to add users to groups, and it's a lot safer.
man 5 securetty
man 1 minicom
Remote Serial Console HOWTO:
Chapter 8, "Managing Users and Groups," in Linux Cookbook, by Carla Schroder (O'Reilly)