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

download the YouTube video

  There are many download tools for YOUTUBE, including online direct conversion and downloading, using REALPLAYER to download, and various other tools.   And here I will introduce the download software YouTube Downloader HD .  That it is very easy to use and the update is relatively fast. You can download the software here: https://www.youtubedownloaderhd.com/ This is free to use. It contains absolutely NO ADWARE, NO SPYWARE, NO REGISTRATION, NO POPUPS, NO MALWARE or other unwanted software. After you download the software, just double click the exe file and install procedure as below: 1. Click Next 2, Click Next 3.Click Next 4. Finish How to use? 1. Just open a browser and go to Youtube, copy the URL of the video, and paste it to the Video URL   In fact, as long as you copy the URL on Youtube, it will automatically paste it for you when you go back to Youtube Downloader HD. 2. Select the quality or format you want to download. If the video you are downloading has a ...

Windows 7 Jumplist disappear solution

The advent of Windows 7 does make many people think this version of the operating system is very good. It is much better than Windows Vista, which is slow and incompatible with many programs.   And Windows7 also has many new functions like JumpList.  The function of JumpList is mainly to easily find related files (for example, Microsoft word) that have been opened with this program recently.   People who have used JumpList will like this feature very much. But if you open JumpList and find that the related files that you opened no longer appear on JumpList, what should you do?

Reset or initialize Microsoft Word setting

I believe that many people will set certain settings when using Microsoft Word but forget them.   It may cause inconvenience in use, so I want to restore the original settings.   Some people may choose to reinstall Microsoft Word, but this is quite time-consuming.