Managing users on CentOS 8

When you initially set up your server, you will only have root access. For security purposes logging directly into your server as root should be disabled. Since root login will be disabled, in this article we will go over how to disable root access and creating new users so that you may access your server. 



  •  CentOS server
  •  Root access


First, you need to disable root login access. You want to disable this access to prevent any malicious actors from brute-forcing the password and thus gaining root access to your server. With root access, hackers will be able to do all kinds of nasty things that may run up the CPU usage, which will cost you a lot of money. 


Using the text editor of your choice edit  the /etc/passwd file set the root account shell to /sbin/nologin


Next, let’s add a user using the following command. 

sudo adduser username


Add a password for the user you created. 

passwd username


Delete a user using the following command. 


userdel username


When you create a new user on your server, that user will need to have root privileges granted to them. This will allow them to run commands with root permissions. 

sudo gpasswd -a username wheel


In this article, we went over how to create and delete users, how to grant users with root permissions, and disabling root login access on your server. 

Leave a Reply

Your email address will not be published. Required fields are marked *