The root user on your server has more power than you can imagine, and while sometimes it’s needed, it’s better if it’s not given out unless absolutely necessary. But when you need to install software that needs root access and you’re not logged in as root, installing sudo (superuser do) can be the perfect solution for this problem. In this article, we will learn how to install sudo on a Debian minimal server in under 5 minutes.
Whether you’re new to the world of Linux or you’re a seasoned pro, there’s always something new to learn. In this blog post, we’ll show you how to install sudo on a Debian minimal server in under 5 minutes. We’ll also provide some tips and tricks for troubleshooting along the way. To get started, SSH into your Debian minimal server as root and run these commands: apt-get update apt-get upgrade apt-get -y install sudo apt-get -y purge gksu (This command will remove the graphical user interface program called gksu) After running these commands, reboot your server by typing reboot at the prompt. When it comes back up again, type sudo whoami at the prompt.
Preparing your system
Before we get started, there are a few things you’ll need to do in order to prepare your system for installation. First, you’ll need to be logged in as the root user. If you’re not sure how to do this, consult your server’s documentation. Next, we will update our current packages and then remove unnecessary packages:
We’ll update our current packages with apt-get by running the following command: apt-get update And then we will remove any unneeded packages with apt-get by running the following command: apt-get autoremove –purge Now that your system is prepared, let’s move on to installing sudo! To start, run the following command: apt-get install sudo When prompted, enter Y when asked whether or not to continue installing it. After completing installation of sudo, verify that it has been installed by running the following command: ls -l /usr/bin/sudo
Downloading and installing sudo
If you’re running a Debian minimal server, you’ll need to install sudo in order to give yourself root privileges. Here’s a quick and easy guide to doing so
- Connect to your server via SSH.
- Update your apt package index with the following command: apt-get update
- Install sudo with the following command: apt-get install sudo
- Add your username to the list of users who are allowed to use this privilege with the following command: usermod -aG sudo $USER && logout && login
This will add your username to the list of people who can gain superuser privileges by using sudo before each command. You should see that now when typing sudo nothing happens because it is waiting for you to type in a password. If not, try typing exit then retyping sudo.
Running the update command as root
First, open up a terminal and log into your server as the root user. Then, run the following command: apt-get update. This will update the list of available packages and their versions. Next, run the command: apt-get upgrade. This will upgrade all currently installed packages to their latest versions. Finally, run the command: apt-get install sudo. This will install the sudo package, which will allow you to execute commands as other users. Once it has finished installing, close the window. To make sure that everything went smoothly, try running sudo visudo -f /etc/sudoers. If there are any errors with permissions or file locations (which is rare), then please consult the man page for visudo before editing anything manually.
That’s it! Enjoy using sudo
If you’ve been using Debian for any length of time, you’ve probably noticed that the sudo command isn’t installed by default. This can be frustrating, especially if you’re used to using sudo on other systems. But don’t worry, it’s easy to install. Just follow these simple steps 1) Enter apt-get update && apt-get upgrade && apt-get install Sudo
- When prompted, enter your password and agree to type yes or no depending on what the prompt asks
- When installation is complete, exit your terminal with CTRL+D or CMD+D
- Run visudo -f /etc/sudoers