User Management in Debian and Ubuntu

The steps outline how to add, remove, and modify users on either the or operating systems.

Initial requirements for a Debian system

The majority of the commands in this manual call for superuser rights. Using the sudo command may result in the following error:

: sudo: command not found

Superuser mode must be enabled, sudo must be installed, and your user must be added to the sudo group:

su –
apt-get install sudo -y
usermod -aG sudo yourusername

How to add a new user?

Useradd and adduser are two command line utilities available in Ubuntu and Debian that you can use to establish a new user account.

Adduser is a user-friendly, interactive Perl interface for useradd, a low-level application for adding new users.

Run the following command to use the adduser command to establish a brand-new operating system user account with the name username:

sudo adduser username

As a result, a dialog will appear in which you need to enter a password and additional information:

Adding user `username’ …

Adding new group `username’ (1000) …

Adding new user `username’ (1000) with group `username’ …

Creating home directory `/home/username’ …

Copying from `/etc/skel’ …

Enter new password:

Retype new UNIX password:

passwd: password updated successfully

Changing the user information for username

Enter the new value, or press ENTER for the default

Full Name []: Name

Room Number []: 100

Work Phone []: 123-45-45

Home Phone []:

Other []:

Is the information correct? [Y/n] Y

The command creates a home directory for the new user and copies files from the /etc/skel directory there.

By default, members of the sudo group are granted sudo .
If you want the newly created user to have administrator rights, add to the sudo group:

sudo usermod -aG sudo username

How to delete a user?

There are two command line tools that can be used to delete a user account: userdel and deluser. We recommend using the deluser command as it is friendlier than the low-level userdel command.

To delete a user without deleting the user’s files and directories, run:

sudo deluser username

If you want to remove the user’s home directory and its contents, use the –remove-home flag:

sudo deluser –remove-home username

This will result in the following message:

Looking for files to backup/remove …

Removing files …

Removing user `username’ …

Warning: group `username’ has no more members.

Done.

How to change user password?

To change your own password, use the passwd command with no additional arguments:

passwd

In the system dialog, you will need to enter the old password and specify the new one:

Changing password for username.

(current) UNIX password:

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

To change the password for another user, you need administrator rights and a username:

sudo password username

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!