Creating a New Non-root Linux User
Summary
We are going to create a non-root user that has the same privileges of a root user—we create this type of user because using the root user can end in disaster with a few bad keystrokes. We are mitigating these risks by creating a non-root user. Further, with a non-root user, we can still grant sudo privileges so that we are only executing these sudo commands when necessary and not at all times. Finally, if you are making this machine a central part of your data science workbench, then you can create new user accounts and grant access to some files, directories and applications as you see fit.
Requirements
The following requirements are necessary for successfully completing this tutorial:
- Read & Complete steps in the "Standing Up a Linux Server" Post
Learning Objectives
The following learning objectives are intended to describe what elements will be tackled in this section along with how and why we are doing it this way.
- Create a sudo, non-root user in a Linux Ubuntu 18.04 virtual environment
- Disable remote access via SSH to the root user
Implementation
You should be at a point where you are logged into your new instance as a root user—we are going to create a new user called alpha in this case, grant sudo privileges to this user and then disable our root account. Finally, we will test the solution by logging out and logging back in using only the new user, alpha.
Let's follow the commands below to get things rolling (screenshots follow below):
adduser alpha
You'll now enter a new password, confirm this password, enter some additional information and confirm it all. Now let's give this user the proper sudo privileges and then start using that account:
usermod -aG sudo alpha
su - alpha
Now we can log out of the service and our SSH session and try logging back in using the following commands:
logout
ssh alpha@157.245.209.24
Great, so this should have worked! Let's now adjust some of the system settings to disable the root login using the `vim` text editor:
sudo vim /etc/ssh/sshd_config
While in this file, go ahead and update the following first line and add the next line to the file—you can naivgate within the vim editor using the arrows on your keyboard, typing the "i" button to begin inserting text, and typing the following series of commands to save and exit the vim editor while persisting your changes ("esc" + ":" + "wq" + "enter"):
# /etc/ssh/sshd_config
PermitRootLogin no
AllowUsers alpha
Now let's restart a few processes so that thes echanges go into effect:
sudo service sshd restart
sudo service ssh restart
Now if you log out of the server, then you should not be able to log back in using your original root account, but should still be able to log in using your new alpha account.
Mission completed?
Cheers, JAH!
https://oscialipop.com - cialis 5 mg When a muscle contracts one of the bones to which it is joined remains virtually stationary as a result of other muscles that hold it in place. <a href=https://oscialipop.com>Cialis</a> The Jesty family eventually moved away and settled in Worth Matravers Dorset. Bentyl Internet Vrackq https://oscialipop.com - Cialis
Park NJ, Chang Y, Bender C, Conley Y, Chlebowski RT, van Londen GJ, Foraker R, Wassertheil Smoller S, Stefanick ML, Kuller LH <a href=http://buylasixon.com/>lasix blood thinner</a>
The scientists hope that their research will lead to better diagnostic testing and targeted drugs to treat leiomyosarcoma <a href=https://viagr.mom>does women take viagra</a> While taking beta blockers, patients with a history of severe anaphylactic reaction to a variety of allergens may be more reactive to repeated challenge, either accidental, diagnostic, or therapeutic