how can I disable single user mode

Asked by hoahongdenH on 2009-06-09

please ! help me ! I want disable single user mode ! because single usermode allow change password user root in time boot .
ANd why use to single user mode ? IN redhat or fedora I can disable single user = edit inittab file . But in Ubuntu I can't find inittab file .

I'm from Vietnamese , I can't speak good E

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2009-06-11
Last reply:
2009-06-27

This question was reopened

you can set the root password but this will enable the account as well. You are right to worry about root recovery console and I have personally expressed a disdain for this idea but it does kinda make sense by the fact that if you do forget your password you can change it there and log on.

You could try setting the root pass, I am unsure if it will affect the root logon.

You can always disable it again if you gain nothing.

https://wiki.ubuntu.com/RootSudo

Simone Cianfriglia (crimer) said : #2

You could also set a password in /boot/grub/menu.lst for single user mode, and setting it also for manual editing of grub, thus preventing the possibility to change kernel parameters during boot.

By the way, now ubuntu doesn't use inittab, but it uses upstart, which configuration is in /etc/event.d , one file for every event. You can disable single-user mode editing file /etc/event.d/rcS-sulogin

hoahongdenH (hoahongdenh) said : #3

thanxk everybody ansers !
@crimer
file /etc/event.d/rcS-sulogin

# rcS-sulogin - "single-user" runlevel compatibility
#
# This task runs the sulogin binary during "single-user" mode.

start on runlevel S

stop on runlevel

console owner
script
        runlevel --set S >/dev/null || true
        if [ -x /usr/share/recovery-mode/recovery-menu ]; then
            /usr/share/recovery-mode/recovery-menu
        else
            /sbin/sulogin
        fi

        if [ -r /etc/inittab ]; then
            RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
            if [ -n "$RL" ]; then
                telinit $RL
            else
                telinit 2
            fi
        else
            telinit 2
        fi
end script

I changed line

 RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"

form

RL="$(sed -n -e "/^id:[2-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"

but if i changed line , i can't shutdown with init 0 command . can you help me edit file ?
thaxk a lot ...!

Simone Cianfriglia (crimer) said : #4

You have to comment only the line
start on runlevel S

thus preventing sulogin startup ;)

hoahongdenH (hoahongdenh) said : #5

I guess commnet the line "/etc/event.d/rcS-sulogin"

 # start on runlevel S

Launchpad Janitor (janitor) said : #6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.