Solved

Automatically enter root password when FSCK fails

Posted on 2006-06-28
8
640 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 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 34

Accepted Solution

by:
Duncan Roe earned 168 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 166 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 166 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

728 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