![]() Root:x:0:0:root:/root: /sbin/nologin Change root User Shellįrom now on, when root user logs in, he/she will get the message “ This account is currently not available.” This is the default message, but, you can change it and set a custom message in the the file /etc/nologin.txt. The simplest method to disable root user login is to change its shell from /bin/bash or /bin/bash (or any other shell that permits user login) to /sbin/nologin, in the /etc/passwd file, which you can open for editing using any of your favorite command line editors as shown.Ĭhange the line: root:x:0:0:root:/root:/bin/bash Once you have created a user with administrative privileges, switch to that account in order to block root access. Next, add this user to the appropriate group of system administrators using the usermod command, where the switch -a means append user account and -G specifies a group to add the user in (wheel or sudo depending on your Linux distribution): # usermod -aG wheel admin #CentOS/RHEL ![]() The flag -m means create user’s home directory and -c allows to specify a comment: # useradd -m -c "Admin User" admin In this article, we will explain four ways to disable root user account login in Linux.Īttention: Before you block access to the root account, make sure you have created an administrative account, capable of using sudo command to gain root user privileges, with the useradd command and give this user account a strong password. Therefore, it is advisable to disable the root access in your Linux server, instead, create an administrative account which should be configured to gain root user privileges using the sudo command, to perform critical tasks on the server. In addition, this account may also be abused by using it improperly or inappropriately either accidentally, maliciously, or through contrived ignorance of policies. In this regard, any errors by the root user may have huge implications on the normal operation of a system. It is used to perform any kind of task on a system to create/update/access/delete other users’ accounts, install/remove/upgrade software packages, and so much more.īecause the root user has absolute powers, any actions he/she performs are critical on a system. This account has access to all commands and files on a system with full read, write and execute permissions. ![]() ![]() The root account is the ultimate account on a Linux and other Unix-like operating systems. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |