🔓Non-root Users
creating and managing non-root users
here is a step by step guide to creating a non-root user in any Linux
prerequisite
A working Linux with
useradd
&openssl
installeda terminal to access Linux
Creating non-root user
there are two ways to create a non-root user ( thanks to tools in Linux ) one shows a prompt that asks all the details required & sets up everything itself and the other is more like linuxy way ( we are doing the second way cause it's good for one-liners )
useradd
useradd
useradd is a low level utility for adding users
make sure to install OpenSSL with
apt install -y openssl
for this guide let's say the username you want to create is ubuntu and the password for it is foxy1. add username and password to a variable to make the process easier
then copy-paste the below command in your terminal
Now you successfully created a non-root user
Adding SUDO
rules for new user
SUDO
rules for new useryou may observe that the traditional way for adding a user to the sudo group won't work cause sudo daemon service can't start in proot. but adding rules to sudoers.d
will do the job as a workaround
to do this add username to variable
then add sudo rules with this command
Now you see sudo working when you login to you new non-root user
Last updated