As many users discover to their frustration, UNIX
was originally developed on TeleType machines that had no backspace
operation. Consequently, the process of editing input data was performed
by printing characters: #, delete one character
and @, delete the line. Interrupt was defined as
Rubout (ASCII DEL). This situation has carried over to the process
of logging in to a system. #, @, and DEL are still the HP-UX default login control characters today.
Once they have logged in, users get around this
inconvenience by including the stty command in
their .profile and .login scripts to change DEL, #, and @ to commonly used control characters, such as ETX (Ctrl-C), backspace (Ctrl-H), and NAK (Ctrl-U), respectively.
You can change the login control characters used
by such programs as getty, rlogin, ssh, and telnet. To do this,
you use stty to set the desired parameters on a
special device file named /dev/ttyconf. See stty(1) for details.
The /dev/ttyconf file provides
a way to change the default behavior for all logins by all users. /dev/ttyconf represents a terminal device and maintains
a set of all the terminal control characters that can be displayed
by stty. The parameters of any terminal device
file can be viewed and modified by passing the file as input to the stty command.
When a system is rebooted, the contents of /dev/ttyconf are reset to the default values, as displayed
here by stty with the -a option:
# stty -a < /dev/ttyconf
min = 4; time = 0;
intr = DEL; quit = ^\; erase = #; kill = @
eof = ^D; eol = ^@; eol2 <undef>; swtch <undef>
stop = ^S; start = ^Q; susp <undef>; dsusp <undef>
werase <undef>; lnext <undef> |
To change any of the displayed parameters, execute stty with the appropriate options. For example, to change
the system defaults for intr, erase, and kill to Ctrl-C, Ctrl-H, and Ctrl-U, respectively, enter the command:
# stty intr ^C erase ^H kill ^U < /dev/ttyconf |
To see just the variations from the defaults,
enter stty without options:
# stty < /dev/ttyconf
intr = ^C; erase = ^H; kill = ^U;
swtch <undef>; |
Unlike the other login commands, the getty command does not automatically use /dev/ttyconf; it requires the -f option. In the /etc/inittab file, add the -f option to each getty command. The next time the terminal device is reopened, getty will use the new settings. In order to reset the
system console, you must reboot the system. See getty(1M) for details.
To set /dev/ttyconf every
time the system boots, add the stty command to /etc/inittab. If you place it before the getty command for the console, the console will also use the revised control
characters:
For example, change:
cons:123456:respawn:/usr/sbin/getty console console # system console
ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600
|
To:
ttco::bootwait:/sbin/stty intr ^C erase ^H kill ^U < /dev/ttyconf
cons:123456:respawn:/usr/sbin/getty -f console console # system console
ttp1:234:respawn:/usr/sbin/getty -f -h tty0p1 9600
|