Sudo: command not found

Many newbie may panic in this error when they try to ssh into a new server via command line or when they are trying CLI (Command Line Interface) for the first time.

-bash: sudo: command not found

Let’s see what is this and how to fix it.

What is this error?

The system is prompting that sudo command is not there in system to run.

It happens when the system is installed with minimal run version. Or installer is used on very low resource system with minimal resources. By default Debian doesn’t install sudo application when the system is installed with minimum package.

What is solution to this error?

Simple, just switch to root user and install sudo. That’s it.

If you are a regular user then switch to root user.

su -

Now, install sudo.

apt install sudo

This is optional, but you may need this!

Want to make normal user sudo. If you installed system with root and a normal user as well, you’ll find that regular user won’t be allowed to do sudo operations.

So it is better idea to make normal user sudo enabled.

usermod -aG sudo username

Now exit and back to normal user.

exit

now you will back to normal user again.

Now try to run sudo command, it will run normally.

Leave a Reply

Your email address will not be published. Required fields are marked *