Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aresnick/8b1150cb223ed45df583 to your computer and use it in GitHub Desktop.
Save aresnick/8b1150cb223ed45df583 to your computer and use it in GitHub Desktop.
Fix for corrupt Dropbear host file for BeagleBone
// Fix for corrupt Dropbear host file, found via http://nucleussystems.com/blog/ssh-on-the-beaglebone-black/
// Run in the Cloud9 IDE at 192.168.7.2:3000
var fs = require('fs');
var destroyed_key_file = '/etc/dropbear/dropbear_rsa_host_key';
fs.readFile(destroyed_key_file, function(err, data) {
if (err) throw err;
if (data === null || data.length === 0) {
console.log("we have a corrupted host key file... try do delete it");
fs.unlink(destroyed_key_file, function(err) {
if (err) throw err;
console.log('successfully deleted ' + destroyed_key_file);
console.log('you should now reboot your beaglebone.');
console.log('the /etc/init.d/dropbear script will create a new rsa host key file for you.');
console.log('after the reboot you should be able to login over ssh');
});
} else {
console.log("it seems that you have another problem, sorry");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment