How to ask for root password every time X starts?

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
watchdog
Posts: 85
Joined: Fri Dec 13, 2019 4:32 pm
Has thanked: 14 times
Been thanked: 12 times

How to ask for root password every time X starts?

Post 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.

watchdog
Posts: 85
Joined: Fri Dec 13, 2019 4:32 pm
Has thanked: 14 times
Been thanked: 12 times

Re: Ask for root password every time X starts

Post 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
williwaw
Posts: 1939
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 170 times
Been thanked: 368 times

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

Post 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

Post Reply

Return to “Users”