To add a serial login password you need to modify the configuration of the/etc/inittab file, but different development board situation is not the same, some do not have this file, BusyBox will check whether the/etc/inittab file exists, if this file does not exist, The BusyBox will use the default Inittab configuration. It will primarily set default actions for system reboots, system hangs, and init restart. In addition, it also sets the start Shell action for the first four virtual consoles (/dev/tty1 to/dev/tty4). If these device files are not established, BusyBox will error. If a/etc/inittab file exists, BusyBox will parse it and record its commands in the internal data structure for timely execution. BusyBox can
The Inittab file format that is recognized is well documented in the documentation included with the BusyBox kit.
Inittab inside the content has a certain format, specific format online a lot, here is no longer elaborate.
One
If there is this file Vi/etc/inittab open
Modify the/etc/inittab file
Put
:: askfirst:-/bin/sh
Tty2::askfirst:-/bin/sh
All bets off.
Add a row
:: Respawn:/sbin/getty-l ttyS0 115200 vt100
This ttyS0 is the serial device device file but different system, the device filename due to the different serial drive, then how to confirm their serial device is which one?
The method is:
Cd/dev//Open the folder where the device files are displayed dev
LS ttys*//Display all the first four letters are ttys device files
My system appears to be ttySAC0, ttySAC1, ttySAC2, TtySAC3, ttySAC4
The method used to determine which serial device is the echo qqqqqqq >/dev/ttysac0 I've tried all 5 devices above and found that only ttySAC0 can print out QQQQQQQ description ttySAC0 is the serial device file I'm looking for.
Then I will: Respawn:/sbin/getty-l ttyS0 115200 vt100 ttyS0 Replace with ttySAC0
And then save the exit
Then, under the command line, passwd
You will be prompted to set a password to root, set the password and confirm the password
Reboot restart
The user name and password will be required after the reboot.
XXXXXX Login://root
passwd://Enter the password previously set
But each exit must use Exit command to exit the terminal, if directly unplug the serial line, the next plug can be directly into the system, do not need to enter a password.
Some articles say the terminal set midstream control to choose Xon/xoff, otherwise there is no way to enter the user name password. But I tried the flow control select "None" to enter the user name and password can also be entered.
It is necessary to mention that the sbin under the Getty is a Linux open and set the Terminal command, the terminal to open, terminal initialization, set the terminal.
Two
If/etc does not inittab This file, BusyBox will use the default Inittab configuration
In other words, the default startup script will be started, if you want to set a serial login password, you need to create a inittab file in/etc, the contents of the file is
:: Sysinit:/etc/init.d/rcs//sysinit The following path is the boot script required for system startup, the different paths of the system are not the same, can be added according to their own needs
:: Respawn:/sbin/getty-l ttyS0 115200 vt100//ttyS0 fill in according to the method in (I.)
Then set the password and reboot will be OK.
Some summary of adding password to embedded Linux serial port