?
Solved

Automatically enter root password when FSCK fails

Posted on 2006-06-28
8
Medium Priority
?
645 Views
Last Modified: 2008-01-09
Does anyone know how to automatically enter the root password when FSCK fails @ the following prompt?  I want it to automatically enter the root password or bypass this to bring me to the shell automatically.  Woudl I have to edit any of the rc start-up scripts?  Thanks for any help.


enter root password or <CTRL> D
0
Comment
Question by:techie411
6 Comments
 
LVL 22

Expert Comment

by:pjedmond
ID: 17004651
I presume that this is during startup?

There is a good reason for asking for the root prompt, as you have access to the whole file system. In order to avoid this, you need to make the system boot into single mode *unless* you fancy patching the code? Assuming that this was during startup, then someone else may come up with a way of doing this automatically, but at the moment I'm afraid I can't think of any 'obvious' solution.
0
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 672 total points
ID: 17005366
You may be able to find that text ("enter root password ...") in the rc script that runs fsck; or you may find an invocation of sulogin. My copy of sulogin prompts as follows:
Type control-d to proceed with normal startup,
(or give root password for system maintenance):

is that the message you see?
If so, ypu could replace sulogin with bash in the script: that will give you a root shell prompt and no password asked for.
Otherwise, you should find the commands that generate the prompt in the fsck-runnung script (grep for fsck in your rc script directory) - they will be invoked in the case of a serious failure. Again, replace with a simple invocation of bash.
0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 664 total points
ID: 17007249
OK - Found it - on a Redhat system it's in:

/etc/rc.d/rc.sysinit

search for sulogin and comment out ot replace as appropriate.


Thanks to duncan_roe for the inspiration:

find /etc | awk {'print "echo " $0";cat " $0 " | grep sulogin"'} | /bin/bash > output.txt

gives all scripts and files containing the command sulogin in the /etc dir.

(   (()
(`-' _\
 ''  ''
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 664 total points
ID: 17007453
If it's RH or FC, my sollution was to force fsck not to fail. But it may fail for other filesystem than ext2/ext3 - never tested
echo "-y" > /fsckoptions # answer yes to all questions
chattr +i /fsckoptions # prevent from deleting
0
 

Author Comment

by:techie411
ID: 17011338
How do I split points?  I'd like to give them to all 3 of you.  Thanks for your answers!  Much appreciated!! =)
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17011498
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question