Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I made a big mistake. Instead of typing :

rm -rf /etc/sysconfig/network-scripts/ifcfg-eth0

I typed:

rm -rf /etc/syconfig/network-scripts

Can anybody help me to repair this mistake?

Thanks in advance!

share|improve this question
1  
Oh, don't use -r if you're deleting individual files. –  cjc Feb 8 '12 at 15:29
    
Restore then from your backup? –  Zoredache Feb 8 '12 at 17:54
add comment

2 Answers

up vote 5 down vote accepted
$ rpm -qf /etc/sysconfig/network-scripts/
initscripts-9.03.27-1.el6.centos.i686

So, get the initscripts RPM and re-install it.

Update:

You can get it from http://mirrors.kernel.org/centos/6.2/os/i386/Packages/initscripts-9.03.27-1.el6.centos.i686.rpm

Of course, you can get your network interface up and running without actually using the "ifup" script, or whatever. They're basically wrappers for "ip" or "dhclient" in any case. For example, if your eth0 interface is supposed to get its configuration dynamically, you should be able to run "dhclient eth0" directly. If it's static, you should be able to run "ip link set dev eth0 up ; sleep 10 ; ip addr add 192.168.1.100 brd 192.168.1.255 dev eth0" or something like that. Consult "man ip" for the actual options. (I'm old fashioned, and am more used to running ifconfig eth0 192.168.1.100 up or something similar).

share|improve this answer
    
yes, but I cannot connect to internet from the machine! –  artaxerxe Feb 8 '12 at 14:11
4  
Well, you're posting to the Internet right now, so can you do a sneakernet? You can get the RPM from mirrors.kernel.org/centos/6.2/os/i386/Packages/…. If you want to get an interface up, you can use "ifconfig eth0" or "dhclient" commands, or something like that. The network-scripts scripts are mainly wrappers for those, anyway. –  cjc Feb 8 '12 at 14:17
    
thanks cjc! It works very good! –  artaxerxe Feb 9 '12 at 6:38
add comment

Here's a list of what would have been in that directory and what some of those files would have looked like.

Type them in by hand until you can get the box back on the network.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.