Fedora Core 1 Big Problem

Wingy

[H]ard|Gawd
Joined
Dec 18, 2000
Messages
1,294
I'm working on my development server right now. I have it setup to back up to a tape every night, and for the past couple months, it's worked great. This morning I saw various errors about bad mediums at st0... So I'm guessing it's a bad tape. I dunno if that has anything to with the following, but here goes.

Today, I was working on a bunch of files for phpBB. I used a little shell script I wrote theother day for replacing text in many files. I've used the script before, and never had any problems. It calls sed to change text. there are also some file renames, then file deletions, so that I can replace the text nicely. Anyway, I ran it with incorrect parameters, and My dumbass didn't put in any error catching... Eitherway, sed threw a bunch of errors. But then, next thing I know, I'm denied permission to the 'ls' command, and 'cd' command. I reboot the server, get to the login screen.

Instead of seeing: "dev login: " I see "(none) login: " (The server's name is dev).

Anybody have any clue what the hell I could have done? I'd show you my shell script, but unfortunately, I cannot get to it.

Any help you could give me would be appreciated. Thanks.
 
You ran the script as root, didn't you?

BAD ADMIN, no cookies!

Seriously, this is why there is privledge seperation. Not much to do but boot into rescue mode, reset your root password, and start the clean up ( /etc/sysconfig is where I'd start ).

And stop running your scripts as root. It makes baby jesus cry. Do you want to make baby jesus cry? I DIDN'T THINK SO.

( this post is a direct result of the amount of caffiene NOT in my system at this time )
 
your running fedora as a server? why not redhat EL, or if you worried about the licensing whitebox linux which is a free clone of redhat EL.
 
Well I'm as noob as they get. I'm not quite sure what I will have to clean up. For now, I should prolly start by making everything ok with baby Jesus.

Any advice for me at this time?
 
ive been working ALOT with redhat es 3 at work setting up servers and i like it ALOT. im almost to the point where id rather load that on my workstation/desktop rather than another distro. its very easy to work with and there is alot of support on the net for it.
 
Well, not much I can recommend, beyond a wipe and reload. Hell, I've been playing with RH since version 5.0, and I would probably just do a wipe and reload. Less trouble.

To prevent this from happening in the future, create a seperate login, and work under that. A good rule of thumb is to use root only when there is no other way to do what you want to do as a normal user ( basically, the sensitive administrative tasks ).

Your data MAY still be there, there is no way to tell what happened until you get the drive mounted. This is why I'd do a reinstall on to a seperate drive, then reconnect the fubar'd drive when you boot up into the new system.
 
God this is not good.

Is there a reason that when I try to enter into the rescue mode it launches the installation?
 
from the sounds of it id say you blew away some important system files in the /sbin and /etc folder, id highly recommend reinstalling.
 
would it be possible for me to post the script for you all, and let you see what it could have damaged?

And also, can I reinstall over what I already have on there, so basically install without losing any data on there?

BTW, I figured out I was being stupid when getting into the rescue, all my data and the users files are still there.
 
yea, post the script, im not that great at scripting but ill see what i can do...
 
Code:
#!/bin/bash
for filename in $1/*; do
     if [ -d $filename ]; then
           tfrep $filename $2 $3
     else
            mv $filename "$filename.tmp"
            sed -e 's/"$2"/"$3"/g' "$filename.tmp" > $filename
             rm -f "$filename.tmp"
     fi
done
Ugly, I know. First one I've ever done. But basically, it's supposed to be used like this:

tfrep dir word1 word2

and then move recursively through dir, searching every file, and replacing every instance of word1 with word2. I have had some success with this script.
 
yea, i would be VERY CAREFULL running a script like this as root, when you combine recursion and the rm command together.
 
the directory it ran on was far away from important things. Also, the script was showing error messages because of bad parameters, so I really don't know what exactly this thing did.
 
Back
Top