How to add and delete users on CentOS 8

When configuring a new Linux server, the first thing is to add or remove users. Each user has different permission levels, and specific settings for various command lines and applications.

This article explains how to add and remove users on CentOS 8.

1. Prerequisites##

To create or remove users, you need to log in to the system as root or another user with sudo privileges.

2. How to add users on CentOS 8 system##

On CentOS systems, you can use the useradd command to create a new user account with the username you want.

For example, to create a new user named "linuxize", you can run:

sudo adduser linuxize

Once successful, this command will not output any prompts. It will create the user and the user's home directory (/home/linuxize), and copy the files from the /etc/skel directory to the user's home directory. In the user's home directory, the user can write, edit and delete files and folders.

If you are logged in as root, you do not need to add sudo before each command.

Next, you need to set a password for the new user so that the user can log in. To do this, run the passwd command with the username:

sudo passwd linuxize

You will be prompted to enter and confirm the password:

Changing password for user linuxize.
New password: 
Retype newpassword: 
passwd: all authentication tokens updated successfully.

Make sure you use a strong password that contains uppercase and lowercase letters, numbers, and special symbols.

2.1 Grant Sudo permissions###

On CentOS system, all members of user group wheel can use sudo to access.

If you want the newly created user to have administrative rights, add the user to this user group:

sudo usermod -aG wheel linuxize

You can also configure user sudo access rights by modifying the sudoers file.

3. How to delete users on CentOS 8 system##

To delete a user account that is no longer needed, enter the userdel command and the user name.

For example, to remove a user account named linuxize, you need to run:

sudo userdel linuxize

Once successful, this command will not produce any output prompts.

The above command will remove the user, but will not delete the user's files. Of course, the user is also deleted from any group he belongs to.

To delete a user, and delete their home directory and mail, run userdel with -r option:

sudo userdel -r linuxize

Four, summary##

We show you how to add and remove users on CentOS 8. The same command applies to any other Linux distribution.

CentOS, like other Linux distributions, is a multi-user operating system. Knowing how to add and remove users is a basic skill that every Linux user should know.

Original: https://linuxize.com/post/how-to-add-and-delete-users-on-centos-8/

Recommended Posts

How to add and delete users on CentOS 8
How to add swap on CentOS 7
How to install and configure Elasticsearch on CentOS 7
How to install and use Docker on CentOS 7
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install and uninstall tomcat on centos
How to install and configure Redmine on CentOS 8
How to install and configure NFS server on CentOS 8
How to install and use Cockpit on CentOS 8/RHEL 8
How to install jdk1.8 on centOS7
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install TensorFlow on CentOS 8
How to Update to gcc4.9.x on Centos7
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install GCC on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to disable SELinux on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install and configure Postfix mail server on CentOS8
How to add swap space on Ubuntu 20.04
How to increase swap space on CentOS 8
How to install Apache Maven on CentOS 8
How to add users to Sudoers in Ubuntu
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to modify the hostname on CentOS 8