Page 1 of 1

How to ask for root password every time X starts?

Posted: Thu Jul 27, 2023 2:05 pm
by watchdog

I have modified /etc/inittab for asking a password for root login at boot.

Code: Select all

::sysinit:/etc/rc.d/rc.sysinit
tty1::respawn:getty 38400 tty1
tty2::respawn:getty 38400 tty2
::ctrlaltdel:/sbin/reboot

I changed the root password from woofwoof with the command:

Code: Select all

passwd

Is there a way for asking that password every time X starts? I think xwin script should be modified.


Re: Ask for root password every time X starts

Posted: Thu Jul 27, 2023 2:42 pm
by watchdog

Roughly, I renamed /usr/bin/xwin as xwin-exec and created a script in /usr/bin named xwin with the following content:

Code: Select all

#!/bin/sh
echo -n "Password: "
read -rs password
echo
if [[ "$password" == "xxxxxxxxx" ]]; then
  echo "Password correct!"
  /usr/bin/xwin-exec
else
  echo "Password wrong."
  reboot
fi

Re: How to ask for root password every time X starts?

Posted: Fri Jul 28, 2023 4:21 am
by williwaw

for everytime you might have to drop out of the shell you are in, back into the login shell again,
ie, logout when the xsession terminates