Contents |
The system starts automatically the graphic display without asking for any password. The file /etc/default/default_login contains on one line the name of the user to create. If the file doesn't exist, leneuf user will be used. This user can be used for the first machine configuration.
Autologin is activated one time per system boot. We are going to use the combonation of the guetty program and busybox login to create this function.
We are going to replace the /usr/bin/login program by a simple shell script (/bin/9login) which is going to act like a wrapper. It will ensure many roles:
The file /etc/inittab is modified like below:
... tty1::once:/sbin/getty 38400 tty1 -n -l /bin/9login tty2::respawn:/sbin/getty 38400 tty2 ...
Login DON'T verify the password if the user launching it is the root. This option is used as an argument on getty.
Login launch automatically alogin shell. In the .profile, you just have to launch the Xwindows session to start the necessary tools.
#!/bin/sh
# Copyright: 9neuf-cegetel
# Licence: GPL
# Get the default login
default_login="leneuf"
if [ -f "/etc/default_login" ]; then
# Only this character set is authorized
/bin/grep -q "[a-zA-Z0-9]*" /etc/default_login
if [ $? -eq 0 ]; then
default_login=$(cat /etc/default_login)
fi
fi
# Test if the user exist
id $default_login >/dev/null 2>&1
if [ $? -eq 0 ]; then
# Create the account directory if it doesn't exist
if [ ! -d /home/$default_login ]; then
/bin/mkdir /home/$default_login
(cd /etc/skel/ ; /bin/cp -a . /home/$default_login/)
/bin/chown -R $default_login:$default_login /home/$default_login
fi
exec /bin/login -f "$default_login"
else
exec /bin/login
fi