Skip to main content

Cancel Linux Root login directly to avoid be hacked


I believe many friends have used Linux, such as Fedora, RedHat, Ubuntu and other Linux operating systems.
 
Of course everyone knows that after logging in with ROOT, you can directly control all operations, including creating files and deleting files.
 
This is really good for some users, but it can be trouble if it is hacked, especially the server administrator. So just think of a way to cancel the ROOT login directly, first create a user who do not have the permssion to create or delete files, and then use this account to control the linux without using the root user directly This is a basic guarantee.


How to achieve?
1.
First, log in to the root user (or a user with root privileges) and modify the following files:
 
vi /etc/ssh/sshd_config
 
look for the text #PermitRootLogin yes,  modify to PermitRootLogin no
 
and then save with this command
:wp
 
2.
Then create a new account, named admin (any name you want), Use the following command:
 
useradd admin
 
After creating an account, remember to add a password for this account, use the following command:
 
passwd admin  (Be careful to add a name after passwd, otherwise you will change the password of your account. If your login name is root, the root password will be changed. Pay attention to this point)
 
Then input the password.
 
3.
Finally, restart the ssh service and you are done.
 
If it is LINUX, enter the following
/etc/init.d/sshd restart
 
If it is FreeBSD, enter
/etc/rc.d/sshd restart
 
 
Now you can log out of the root account first, and then try to log in with admin. After logging in with admin, you will find that you cannot delete and create documents, just use
su - 
command to switch the root user account
 
Well, I hope everyone can provide simple and basic protection for your Linux operating system.

Comments

Popular posts from this blog

Change the Outlook Email Size via Google App Sync

 If you are using the google Business or School Gmail account, you may also using the Outlook to sync the Gmail. However, you may find that some emails are missing such as the emails can not show more than one month's emails. If you encounter this issue, please note that it is because the google App Sync is not configure correctly. Please follow me to do a simple change to achieve sync more email from Gmail to your outlook client.

install VMware vCenter Server 6.5 step by step

I recently recorded the steps when I tried to install VMware vCenter Server, version 6.5.   if there is any mistake, please correct me. Thank you

Fix google chrome crash issue

Have you encounter google chrome crash when you open the google chrome? Is it happened in Windows 10? Have you tried to recover the windows but can not work? Have you tried to reinstall the Google chrome few times but still not working? If the answer is yes, please tried to follow the procedure as below: It may the best solution when you fixed the problem without reformat your windows. Windows 10: press the key sequence   Win + R type regedit in the window that opens and press Enter   click  Yes to start the program navigate to the registry keys as below   Computer\HKEY_LOCAL_MACHINE\ Software\Policies\ Google \ Chrome If not exist, you can create it. Right Click,  New --> Key and rename it with the right value name right click on the right side of the resource explorer, New -->   DWORD (32-bit) Value Rename the variable with:    RendererCodeIntegrityEnabled    re-open google Chrome...