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.

On my debian maschine I deleted /bin/bash by accident. Is there a way to get it back without reinstalltin the machine?

If it helps. I'm still logged in. Guess once I'm out I cannot log in since it's my login shell.

share|improve this question
1  
First, I'd change my login shell for anything else in /etc/shells. This would be my first move (don't use /sbin/nologin ;-)). Then I'd fix it. –  CloudWeavers Nov 23 '12 at 13:03

2 Answers 2

up vote 20 down vote accepted
ln -s /bin/sh /bin/bash
apt-get install --reinstall bash
share|improve this answer
    
Great! You made my day! –  BetaRide Nov 23 '12 at 13:06
    
Do you have to destroy the link, or will it just get overwritten? –  chovy Nov 25 '12 at 21:15
    
It will get overwritten. –  FINESEC Nov 25 '12 at 23:57

if you're still logged in, then issue the following command:

sudo apt-get install --reinstall bash
share|improve this answer
    
This will not work, see my answer. –  FINESEC Nov 23 '12 at 13:02
    
you are right. unless a person changed the /bin/sh link from dash to bash, as some do, in which case both our solutions will hiccup. –  Waleed Hamra Nov 23 '12 at 13:21

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.