/bin/bashの内容は何であり、誤って上書きした場合はどうすればよいですか?

/bin/bashの内容は何であり、誤って上書きした場合はどうすればよいですか?

誤って/binフォルダに入れようとしたばかばかしいスクリプトで/bin/bashファイルを上書きしました。

このファイルの内容をどのように検索しますか? Webでコンテンツを見つけて再コピーする方法はありますか?端末で「シンボルリンクが多すぎます」というエラーが発生した場合、ここで選択できるものは何ですか?

私はまだこの種の仕事に初めて触れ、私が受けることができるすべての助けに感謝します。

編集:Kali 2.2 Rollingを使用していることに言及するのを忘れました。 Kali 2.2 RollingはほぼDebianですが、いくつかの追加機能があります。

編集2:数日前まで私の間違いを気づかなかったので、コンピュータも再起動しました。これはこれを非常に困難にします。

ベストアンサー1

コンピュータをシャットダウンしないでください。

まだ実行中のシェルはありますか?バッシュですか?だとしたら大丈夫です。 (しかし、再びそうしないでください。)

ランニング:

sudo cp /proc/$$/exe /bin/bash

見て、すべてが大丈夫です。


コメントの誰かがこれがうまくいくかどうか疑ったので:

[vagrant@localhost ~]$ cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
[vagrant@localhost ~]$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
[vagrant@localhost ~]$ echo $0
-bash
[vagrant@localhost ~]$ sudo rm /bin/bash
[vagrant@localhost ~]$ bash
-bash: /bin/bash: No such file or directory
[vagrant@localhost ~]$ sudo su -
su: /bin/bash: No such file or directory
[vagrant@localhost ~]$ sudo cp /proc/$$/exe /bin/bash
[vagrant@localhost ~]$ bash
[vagrant@localhost ~]$ exit
[vagrant@localhost ~]$ sudo su -
[root@localhost ~]# logout
[vagrant@localhost ~]$ 

おすすめ記事