LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2004, 07:52 PM   #1
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Rep: Reputation: 15
Exclamation Emergency - /bin accidentally overwritten


Ok, it's the stupidest thing ever. I mean to type mv -f blah ./*, but what I actually type is mv -f blah /*.

Luckily, it seems the mv died on trying to overwrite /boot, which was right after /bin, which was the first alphebetical directory.

So here's the situation I am in right now - I have shell access, even though bash was removed along with everything else, but since it's still running, I still have it.

I don't have ls, mount, chmod, or any of the other /bin utils.

By chance, I happened to have a webserver elsewhere on the internet that I was able to FTP to and transfer a .gz of the entire /bin directory into my /root.

But, since /bin doesn't exist any more, and mkdir is inside of it, I can't make /bin, nor do I have mv to put the gz file into the directory, though I do have gzip, by way of the same ftp connection.

I have another older version of Mandrake locked away on an unmounted partition, which I can't mount because I don't have that either.

I would really like to avoid totally reinstalling the system, especially since it seems like I can *almost* fix it.

If you have any suggestions, they would be appreciated.
 
Old 02-24-2004, 07:57 PM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
hmm, perhaps you should cd into /bin (cd being an internal command) then ftp the programs indvidually using mget
 
Old 02-24-2004, 07:58 PM   #3
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Original Poster
Rep: Reputation: 15
Regrettable, /bin doesn't exist. Is there a way to force a directory to be created, besides with mkdir?
 
Old 02-24-2004, 07:59 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
better yet use sftp to ftp as root therefore you can cd to the /bin directory on the webserver via ftp and access it
 
Old 02-24-2004, 08:00 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
Quote:
Originally posted by davidbalt
Regrettable, /bin doesn't exist. Is there a way to force a directory to be created, besides with mkdir?
With a little luck you have
mc
somewhere in
/usr/bin
or
/usr/local/bin

Have a look :}


Cheers,
Tink
 
Old 02-24-2004, 08:03 PM   #6
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Original Poster
Rep: Reputation: 15
No MC. Originally, I was hoping to unpack the rpm with MC in it. That's what led me to recognize that rpm and every other useful tool in linux is in the bloody /bin directory.
 
Old 02-24-2004, 08:07 PM   #7
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
ok, so sftp to your webserver, copy over /bin/mkdir then ./mkdir /bin then cd /bin sftp back to your webserver's /bin directory and get everything good luck
 
Old 02-24-2004, 08:18 PM   #8
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Original Poster
Rep: Reputation: 15
Alright. I'm convinced that the last post would work, IF I could chmod the downloaded file to executable. Is there any way to do this manually?
 
Old 02-24-2004, 08:22 PM   #9
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
if you use sftp, it should automatically be executable uppon transfer
 
Old 02-24-2004, 08:23 PM   #10
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Original Poster
Rep: Reputation: 15
Yes, but the webserver rejects my connection via sftp.
 
Old 02-24-2004, 08:27 PM   #11
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
If you had a livecd or at least a minimal rootdisk, you would have any number of ways to do it after rebooting.

Anyone suggest a small livecd iso?
 
Old 02-24-2004, 08:29 PM   #12
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
ok, well you will have to turn on the sshd on your webserver....
 
Old 02-24-2004, 08:30 PM   #13
Joey.Dale
Member
 
Registered: Jun 2003
Location: Tampa, Fl
Distribution: Gentoo, Slackware
Posts: 828

Rep: Reputation: 39
KNOPPIX or Slax
 
Old 02-24-2004, 08:32 PM   #14
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
the command to start sshd would be /usr/sbin/sshd then you should have ssh and sftp access
 
Old 02-24-2004, 08:38 PM   #15
davidbalt
Member
 
Registered: Feb 2004
Distribution: Gentoo -- always from stage1
Posts: 85

Original Poster
Rep: Reputation: 15
Well, my setup is a little unusual since it isn't really my server. It is a Virtual Private Server, which means that I have access to things like /bin, but I can't enable/disable services. I can use ssh, and in fact I am using it, but sftp must be disabled for some administative reason.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
Accidentally overwrote /bin/sh roastedmnm SUSE / openSUSE 5 07-26-2005 02:37 AM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 07:55 PM
AaaaAAAaah help, I made a huge mistake :( accidentally moved /bin! yelgnits Linux - General 10 09-02-2004 07:08 AM
Accidentally deleted /usr/bin/net larley Linux - General 2 07-26-2004 10:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration