Recover accidentally removal of sudo

One day I want to update the vim-minimal to vim-enhanced on a Centos Linux 7 server.

I ran the command sudo yum remove vim and I did not notice that sudo will be removed together with vim-minimal!

As a result, sudo is removed. And there is no way for me to re-install it, since sudo yum install sudo will not work.

I tried several solutions, but they did not work (I have no root password).

Finally I come to the solution: via the help of Docker.

Run the following command:

docker run -v /:/hostOS -i -t chrisfosterelli/rootplease

And you will get into the shell, with root access, and / is mounted. Cool. Then in this shell you can run yum install sudo.

Everything is fine then.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store