LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   knoppix gives root access at diskcheck (https://www.linuxquestions.org/questions/linux-security-4/knoppix-gives-root-access-at-diskcheck-140000/)

trees 01-29-2004 10:59 AM

knoppix gives root access at diskcheck
 
Greetings,
I've installed Knoppix from the cd (knx-hdinstall) on the hard drive and when the system wasn't shut down properly, it does a disk check..(ext3fs). But after doing so, it gives root access for maintainance without asking for a password.
:eek:
help plz
Thanks

jailbait 01-29-2004 11:39 AM

"I've installed Knoppix from the cd (knx-hdinstall) on the hard drive and when the system wasn't shut down properly, it does a disk check..(ext3fs). But after doing so, it gives root access for maintainance without asking for a password."

This behavior means that Knoppix is not sure that the hard drive partitions are OK. The thing to do when it gives you root access like that (it is called failsafe mode) is to run fsck.ext3 or whichever fsck is appropriate against every hard drive Linux partition. After everything is clean then reboot with the shutdown command (shutdown -r now) and everything should be OK.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

trees 01-29-2004 12:33 PM

I guess my question is how to make it ask for root password for maintainance, the computer is in a semi-public place
Thanks

jailbait 01-29-2004 04:04 PM

"I guess my question is how to make it ask for root password for maintainance"

I guess that you will have to change the failsafe script to do something else.

There is a table called /etc/initab which describes what script to run for each run level. This varies some from one distribution to another. In my /etc/initab failsafe mode is called single user mode and is defined as run level 1. Here is the appropriate section in my /etc/initab:

# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

This says that whenever Linux decides to go into run level 1 (failsafe) to run a script called /etc/rc.d/rc 1. You could change your initab to run your own script when Linux goes into failsafe mode.

So what should your failsafe mode script look like? You want to create a version of failsafe that requires a password to login. That is possible. Another possibility is to create a script that handles the error automatically. This script would run the appropriate fsck command against each Linux partition, I suggest that you run fsck with the -p option so that fsck does not ask the user any questions, just goes ahead and does its thing. After the script has done the fsck commands then it issues: shutdown -r now

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

trees 02-02-2004 11:18 AM

In my /etc/inittab there is a line - "What to do in Single User Mode"
Is that the one that I should edit?

This is that line on this computer:
# What to do in single-user mode.
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1

This is the line on another one of our machines in /etc/inittab
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

Here's that part of /etc/inittab:
-------------------------------------------------------------------------------------
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.9 2001/05/31 10:37:50 knopper Exp $

# The default runlevel.
id:5:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
-----------------------------------------------------------------------

jailbait 02-02-2004 12:58 PM

"In my /etc/inittab there is a line - "What to do in Single User Mode"
Is that the one that I should edit?"

Actually, I am not sure which of two line is the one that you should edit. The two possibilities are:

# What to do in single-user mode.
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1

l1:1:wait:/etc/init.d/rc 1

Looking at the two lines, I think that the first one gives you a login with a password prompt and the second one probably gives you a login without a password prompt. You could experiment on a machine on which you can tolerate the occasional crash.

-----------------------
Steve Stites

trees 02-03-2004 01:29 PM

I'll replace the lines and see what happens next time it crashes.
Thanks for your help!


All times are GMT -5. The time now is 04:15 AM.