Fix: sudo command not found

If you’re an experienced Linux user, then you’ll probably find a sudo command not found error extremely disconcerting. You’ve more than likely gotten used to putting sudo in front of any command you need privileged administrator access for. This is doubly true if you’re a user of Ubuntu or any of its derivatives since these operating systems hash out the root account by default thus requiring you to use sudo quite often.

The sudo command itself isn’t included in some distributions of Linux by default, which often includes those geared toward Web and router management. It’s also not included with many versions of the BSD operating systems. Fortunately, it’s not hard to login as root and then install the package individually.

Method 1: Fixing sudo command not found errors on GNU/Linux

It’s highly unlikely you’re using a Linux distribution that doesn’t come with sudo, but if you type something like sudo fdisk -l and push enter only to find you get an error such as sudo: command not found or ash: sudo: command not found depending on whether you’re using the bash or Almquist shell, you might be using one that doesn’t have it. In our example, we set up a virtual machine and tried to use sudo rm to remove files only to get an error. Type whereis sudo to see if that tells you whether it’s installed somewhere. If you just get sudo: as a reply from that command, then you probably don’t have it installed.

You’ll need to be logged in as the root user to fix a sudo command not found, which is hard because you don’t have sudo on your system to begin with. Hold down Ctrl, Alt and F1 or F2 to switch to a virtual terminal. Type root, push enter and then type the password for the original root user. You’ll receive a # symbol for a command prompt.

If you have a system based on the apt package manager, then type apt-get install sudo and push enter. Those who have yum RPM systems based perhaps on Fedora or Red Hat Linux can use the yum install sudo package management command. Agree to the prompts and then wait for the installation. It should be very quick, but you’ll need networking access for it to work.

Now from the root prompt type visudo and push enter. You’ll either receive a nano or vi editor screen. All the way at the bottom of the file include a line that has your user’s name followed by ALL=(ALL) ALL, keeping in mind that your user name is more than likely in lower case. Hence:

user ALL=(ALL) ALL

If you’re working with vi, then push Esc and type :wq to exit. Those using GNU nano should hold down Ctrl and O to save the file followed by Ctrl and X to exit. Type exit at the prompt and you can now use sudo like normal. It should only take a few very simple commands to fix this problem, but fortunately with the inclusion of sudo in most modern distributions it doesn’t tend to be an issue anymore. *BSD users tend to have a bigger issue.

Method 2: Fixing sudo command not found errors on FreeBSD and Other Unices

While BSD operating systems generally come with su, they seldom if ever come with the actual sudo command. Make sure that you’re logged out of your user account and are currently at the Unix login screen. Type root as a user name then push enter followed by the root password and push enter again.

You’ll have an octothorpe in your prompt to indicate that you’re running as a privileged user. To add the binary package for sudo, type pkg_add -rv sudo and push enter. Agree to install it if asked and then wait for the installation. Once it’s installed, type visudo and push enter. Let’s say you want to allow a user named billy to execute any command. Add the following line at the end of the file:

billy ALL=(ALL) ALL

Of course, you’ll want to replace billy with your actual user name. If visudo actually used vi, then push Esc and type :wq to exit the editor. You can log out and then use sudo like normal.

 

The post Fix: sudo command not found appeared first on Android News.

Check Also

Download OxygenOS 5.0.8 for OnePlus 3 and OnePlus 3T

Latest Oreo-based OxygenOS 5.0.8 update for OnePlus 3 and OnePlus 3T starts rolling out. The OxygenOS 5.0.8 update fixes general bugs and brings system improvements and brings November 2018 Security Patch. Download OxygenOS 5.0.8 for OnePlus 3 and OnePlus 3T from below. The update is rolling out via OTA (over-the-air) and many users already getting OxygenOS 5.0.8 for OnePlus 3T. The update is incremental and rolls out in phase wise manner. You can wait for the OTA updates, or you can Update Oneplus 3/3T to OxygenOS 5.0.8 manually with below method. Download OxygenOS 5.0.8 for OnePlus 3 and OnePlus 3T from below. The new OxygenOS 5.0.8 for OnePlus 3T and OnePlus 3 fixes general bugs and brings system improvements. (Check the complete changelogs from below). We provide you the OxygenOS 5.0.8 OTA file which you can flash on your device. So if you want to update your OnePlus to the latest version then Download OxygenOS 5.0.8 for OnePlus 3 and OnePlus 3T from below. Check below what’s new..

Leave a Reply

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