Solved

Automatically enter root password when FSCK fails

Posted on 2006-06-28
8
634 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
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now