The sudo user can be used to run administrative commands on Linux. Instead of using the root user on your rpoduction server, create a new user and give them sudo privileges as illustrated in the video above.
Step 1 : Create the new sudo user in Debian 10 as follows. Give them a unique secure name.
Step 2: Add the user above to the sudo group. Users with sudo privileges can execute root level commands.
usermod -aG sudo n3wus3r19
If you experience an issue whereby sudo is not available in debian 10, install it as follows.
First do a server update :
apt update && apt upgrade
Then apt install sudo
apt install sudo
After installing sudo, restart your server. You can do this via the admin dashboard of your VPS provider or by running :
Step 3 : Try logging in and running a sudo command.
Log out of your server and try logging in with the new user. Remember to restart your server if you had to install sudo.
Once you log in, try running the following command. Enter the user password when prompted.
sudo apt update
That is how to create the sudo user Debian 10.
So if you’re still with me, this is where we had stopped. And what needs to happen now is, we need to create a sudo user. Let me clear. I will clear the screen. In the last video we installed Debian 10 and logged in via Git bash.
We need to set up, as I’ve said, we need to set up a sudo user and the sudo user is going to give us all the admin privileges that we need. Let’s come back to the post here and the link for this is in the description. If it’s not there, just remind me and I’m going to add it.
You can also use putty to log in if you want to. So let’s add the user and I’m going to give it a different name from that.
Give the user a strong password.
All right! Ppassword updated successfully. All these others I can just press enter to skip. Skip all of that. All right, and then the next step is we want to make this user a sudo user, okay . We need to add them; give them the pseudo privileges.
I’ll copy that bit.
And I’ll paste that. And the user is that. Give it the user that you created. This user now is an admin user . So if you do experience any problem depending on the vps that you’re using you may experience a problem whereby this command is not going to work. You’re going to get told that sudo is not recognized. So what that means is that they have a very minimal install of Debian and what you need to do is you need to install sudo. That’s all you need to do. Just install sudo and then run the command again, all right?
The next step is for me to try and log in. I’m going to try and log in with the new details . The new details for this guy and then once we are able to log in and we are able to run sudo commands, I’m going to immediately disable the root user from logging into the server. I will open up a new Git Bash window and then I want to get the IP address.
ip and I want to login, ssh newuser and then the password for the new user.
Okay! There we go. The new user has logged in. Let’s just test if we can run sudo commands. I’m going to do sudo apt update.
Enter the passwor. Every time you use sudo for the first time it’s going to ask you for the password.
And you can see, we can run sudo commands. So that means that everything is working well.
We’ve already set up the new sudo user Debian 10, now, the next process is , let’s see what’s next here. The next process I think we need to set up ssh and I’m not going to set up firewall because I’m going to install virtualmin and virtualmin is going to add all the ports that we need.
The next thing is to set up ssh . You can set up ssh using putty, but I’m also going to show you how you can set it up using git bash. Using the git bash method on windows. If you’re on windows you can set up ssh using git bash or using putty.
If you are on a Mac or a Linux you can use git bash. You can actually follow along with me using Git Bash, but I also do have a very intense tutorial here . Very intensive about how you can set up ssh Authentication on your Linux or Mac computer for your for your CentOS, RHEL or Debian . So this basically works on any Linux distribution. Just follow this if you want to set up your ssh key and be able to log in using ssh and then once we do that we’re going to disable password authentication so that people can only log in using the ssh keys.
If someone doesn’t have the ssh key they will not be able to access the server and that’s the next thing that we’re going to do. I can set up this using git bash or putty but I do have a tutorial with git bash. Let me just look for that, git , et me just search for git bash.
And there we go. You can set up ssh using git bash and this will also work for you if you’re in Windows and you’re following along with git bash. You can use this one as well so this is just the same way that you do it on Linux. Right!
So this is what I’m going to do in the next video. I’m going to use Git Bash to set up ssh authentication. I’m going to see you in that next part. If there’s anything that is not working for you just let me know and we’ll see what the issue could be.
Recommended VPS Providers
Find out the VPS providers I recommend.