Enabling Password-Protected Login Print

 

In the default embedded project available with the Emcraft uClinux BSP the serial console does not require a password. This application note explains how to add login and password protection to the Linux serial console.

The busybox tool has the passwd, getty and login applets. On the host, enable them in the busybox configuration, then edit etc/inittab as below:

::sysinit:/etc/rc
::respawn:/sbin/getty -L 0 ttySTM0

Rebuild the embedded project and boot it to the target. The updated project will support the following credentials:

login: root
password: 123

To change the password, just log in to the board, run passwd root, then copy-paste the content of /etc/shadow from the target to the etc/shadow file in your project directory on the development host. The next build of the embedded project on the development host will pick up the new password into the bootable Linux image.