Prompt Detail:
Here are the steps to create a new non-root user with their own home directory and sudo privileges:
Log in to the server as the root user or a user with sudo privileges.
Create a new user account using the following command, replacing "newusername" with the desired username:
adduser newusername
Set a password for the new user when prompted.
Create a new directory for the user's home directory with the following command, replacing "newusername" with the desired username:
arduinomkdir /home/newusername
Set the correct permissions for the new home directory with the following command:
bashchmod 755 /home/newusername
Change the ownership of the new home directory to the new user with the following command, replacing "newusername" with the desired username:
bashchown newusername:newusername /home/newusername
Grant sudo privileges to the new user by adding them to the "sudo" group with the following command:
usermod -aG sudo newusername
Log out of the root or sudo user account.
Log in to the server with the new username and password.
Test sudo privileges by running a command with sudo, such as:
bashsudo ls -la /root
You should be prompted for your password and then see the contents of the root directory.
That's it! You have successfully created a new non-root user with their own home directory and sudo privileges.