Method and device for controlling root user login, electronic equipment and storage medium

By configuring a unique root password for each device and verifying it in the login request, the problem of the same root password for the same batch of devices in the multi-user operating system is solved, improving the security of the device.

CN119848811AInactive Publication Date: 2025-04-18QI AN XIN TECHNOLOGY GROUP INC
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311586170.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In multi-user operating systems, the default root password of the same batch of devices is the same, resulting in that once the root password of one device is cracked, the root password of other devices in the same batch is also exposed, reducing the security of the device.

Method used

Configure a unique root password for each device, and when receiving a login request, it verifies the root password in the request through its unique root password. The login request is refused if the verification fails.

Benefits of technology

Even if the root password of a device is leaked, it will not pose a security threat to other devices in the same batch, improving the security of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848811A_ABST
    Figure CN119848811A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for controlling login of a root user, electronic equipment and a storage medium, and the method for controlling login of the root user comprises the steps: receiving a login request of the root user, the login request comprising a root password; whether the root password is the root password of the current device or not is judged, and the root passwords corresponding to different devices are different; and if not, refusing the login request. Different root passwords are configured for different devices, after the current device receives the login request, the root password in the request is verified through the unique root password of the current device, and the login request is rejected when the verification fails, so that an attacker can be prevented from logging in a root user of the current device by using the root passwords of other devices, and even if the root password of one device is leaked, the user experience is improved. And safety threats cannot be caused to other equipment in the same batch, so that the safety of the equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to a method, device, electronic device and storage medium for controlling root user login. Background Art

[0002] For multi-user operating systems, such as Unix systems and Unix-like systems, multiple users are allowed to operate in the system. However, if the number of users is too large, it will cause inconvenience in system management.

[0003] At present, in order to improve the convenience of multi-user operating system management, the root user is introduced into the system. The root user has the highest authority in the system and can perform any operation on the system. Therefore, the root user can manage multiple ordinary users in the system, thereby improving the convenience of user operating system management.

[0004] However, multi-user operating systems are pre-installed in devices and provided to users. When the device leaves the factory, the multi-user operating system is configured with a default root password for the root user. The default root passwords of various devices are the same. Once an attacker cracks the root password of one device, the root passwords of other devices are directly exposed to the attacker, thereby reducing the security of the device. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for controlling root user login to improve the security of the device.

[0006] In order to solve the above technical problems, the embodiments of the present application provide the following technical solutions:

[0007] A first aspect of the present application provides a method for controlling root user login, the method comprising: receiving a login request from a root user, the login request including a root password; determining whether the root password is the root password of a current device, wherein different devices have different root passwords; if not, rejecting the login request.

[0008] Compared with the prior art, the method for controlling root user login provided in the first aspect of the present application configures different root passwords for different devices. After the current device receives a login request, it verifies the root password in the request through its unique root password, and rejects the login request when the verification fails. This can prevent attackers from using the root passwords of other devices to log in to the root user of the current device. Even if the root password of one device is leaked, it will not cause a security threat to other devices in the same batch, thereby improving the security of the device.

[0009] In some modified implementations of the first aspect of the present application, before receiving a login request from a root user, the method further includes: configuring the root password generated for the current device as a default root password, or modifying the default root password of the current device to a root password generated for the current device.

[0010] When the current device is manufactured, a unique root password is generated for the current device, or, during the use of the current device, the common root password among various devices is replaced with a unique password for the current device, thereby preventing attackers from using one root password to log in to multiple devices and improving the flexibility of root password configuration.

[0011] In some changed implementation modes of the first aspect of the present application, before configuring the root password generated for the current device as the default root password, or modifying the default root password of the current device to the root password generated for the current device, the method also includes: obtaining a hardware unique identifier of the current device; and processing the hardware unique identifier using a preset first algorithm to obtain a root password generated for the current device.

[0012] Since the hardware unique identifier can distinguish each device, the root password of the current device can be simply and quickly generated through the hardware unique identifier of the current device, thereby improving the efficiency of generating a unique root password for the device.

[0013] In some changed implementation modes of the first aspect of the present application, before configuring the root password generated for the current device as the default root password, or modifying the default root password of the current device to the root password generated for the current device, the method also includes: obtaining a hardware unique identifier and a software unique identifier of the current device; and processing the hardware unique identifier and the software unique identifier using a preset second algorithm to obtain the root password generated for the current device.

[0014] The root password of the current device is generated by the hardware unique identifier and software unique identifier of the current device, which can prevent the hardware unique identifier from being easily cracked, increase the amount of information in the root password, and improve the security of the root password.

[0015] In some modified implementations of the first aspect of the present application, before receiving a login request from a root user, the method further includes: determining whether the current device is physically connected to a terminal; if so, outputting the root password of the current device to the terminal.

[0016] The root password of the current device is usually saved in the current device and is not output or displayed. The personnel input the root password by using the terminal to physically connect to the current device. Because the current device is in the computer room, normal personnel can enter the computer room to physically connect the terminal to the current device. Attackers generally attack through the remote network and cannot enter the computer room. Therefore, this can effectively prevent attackers from stealing the root password of the current device and ensure the security of the current device.

[0017] In some changed implementation modes of the first aspect of the present application, the terminal includes a display and an input device; outputting the root password of the current device to the terminal includes: outputting the root password of the current device to the input device of the terminal, so that the input device transmits the received root password to the display for display.

[0018] By transmitting the root password to the input device, the root password can be prevented from being leaked when being transmitted to the terminal. Then, the root password is displayed on the terminal monitor to prevent people outside the computer room from reading it, thereby ensuring the output security of the root password of the current device.

[0019] In some changed implementation modes of the first aspect of the present application, before determining whether the root password is the root password of the current device, the method further includes: determining whether the login request is a remote login request; if so, rejecting the login request; if not, executing the step of determining whether the root password is the root password of the current device.

[0020] By rejecting remote login requests from the root user, attackers can be prevented from brute-forcing the root user login of the current device through remote operations, further improving the security of the device.

[0021] A second aspect of the present application provides a device for controlling root user login, the device comprising: a receiving module, used to receive a login request from a root user, the login request including a root password; a judging module, used to judge whether the root password is the root password of the current device, wherein different devices have different root passwords; if not, entering a rejecting module; the rejecting module is used to reject the login request.

[0022] The third aspect of the present application provides an electronic device, comprising: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the method in the first aspect.

[0023] A fourth aspect of the present application provides a computer-readable storage medium, the storage medium comprising: a stored program; wherein, when the program is executed, the device where the storage medium is located is controlled to execute the method in the first aspect.

[0024] The device for controlling root user login provided in the second aspect of this application, the electronic device provided in the third aspect, and the computer-readable storage medium provided in the fourth aspect have the same or similar technical effects as the method for controlling root user login provided in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0026] Figure 1 This is a schematic diagram of an application scenario of the method for controlling root user login in an embodiment of the present application;

[0027] Figure 2 The following is a flow chart of the method for controlling the login of the root user in the embodiment of the present application. Figure 1 ;

[0028] Figure 3 The following is a flow chart of the method for controlling the login of the root user in the embodiment of the present application. Figure 2 ;

[0029] Figure 4 The structure of the device for controlling the root user login in the embodiment of the present application is shown as follows: Figure 1 ;

[0030] Figure 5The structure of the device for controlling the root user login in the embodiment of the present application is shown as follows: Figure 2 ;

[0031] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0033] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0034] At present, for devices with multi-user operating systems installed, the default root password is the same when they leave the factory, especially when they leave the factory for the same batch of devices. Once an attacker cracks the root password of a device, the root passwords of other devices in the same batch will also be obtained by the attacker, and the entire device will be completely controlled by the attacker, and the security of the device cannot be guaranteed.

[0035] In view of this, the embodiments of the present application provide a method, apparatus, electronic device and storage medium for controlling root user login. By configuring a root password for each device, even if an attacker obtains the root password of a certain device, since the root passwords of other devices are different from the root password of the compromised device, the attacker cannot log in to the root user of other devices using the root password of the compromised device, thereby ensuring the security of the overall device.

[0036] First, the application scenario of the method for controlling root user login provided in the embodiment of the present application is described.

[0037] Figure 1 This is a schematic diagram of an application scenario of the method for controlling root user login in an embodiment of the present application, see Figure 1 As shown, the scenario may include: multiple devices 11. In each device 11, a multi-user operating system 12 is installed. These devices 11 may be produced in the same batch and installed in a computer room 13 to be used by a user 14. The root password of each device 11 is different.

[0038] After attacker 15 obtains root password 1 of device A through brute force cracking or other means, even if he can use root password 1 to log in to the root user of device A, for devices B, C, ..., device B has root password 2, and device C has root password 3, which are different from root password 1 of device A. Attacker 15 cannot log in to the root user of devices B, C, ... using the root password 1 he obtained. In this way, the security of devices B, C, ... in the computer room 13 can be guaranteed, and all devices in the computer room 13 can be prevented from being attacked by attacker 15 using the same root password, thereby improving the security of the overall equipment.

[0039] In practical applications, the multi-user operating system may be a Unix system or a Unix-like system. The Unix system may be a Solaris, AIX, BSD, etc. Unix-like systems may be a Linux, QNX, etc.

[0040] Next, the specific implementation process of the method for controlling root user login provided in the embodiment of the present application is described in detail.

[0041] Figure 2 The following is a flow chart of the method for controlling the login of the root user in the embodiment of the present application. Figure 1 , see Figure 2 As shown, the method may include:

[0042] S21: Receive a login request from the root user.

[0043] The login request includes the root password.

[0044] No matter which subject needs to use the root privileges in the device, it is necessary to log in the root user in the device, that is, send a login request to the device. The login request contains the login object (that is, the root user), the login password (root password) and other information required for login (for example: the address of the request sender, etc.).

[0045] S22: Determine whether the root password is the root password of the current device. If yes, execute S23; if no, execute S24.

[0046] The attacker steals the root password of other devices and uses the stolen root password to log in to the root user of the current device. Now the root passwords of different devices are different. By comparing the request with the root password in the device, it can be determined whether the current login is the attacker's login using the stolen root password or the user's normal login using the root password of this device.

[0047] The judgment process here is to compare the two root passwords. During the comparison process, the two root passwords can be compared one by one starting from the first character. When inconsistent characters are found, the comparison can be stopped, and the two root passwords can be directly determined to be inconsistent. The two root passwords can also be compared one by one starting from the last character in reverse order. When inconsistent characters are found, the comparison can be stopped, and the two root passwords can be directly determined to be inconsistent. Because the root passwords configured for different devices may be the same in the first few characters, and the probability of the last few characters being different is generally higher, the inconsistent characters can be compared as early as possible, improving the efficiency of root password comparison.

[0048] S23: Allow the login request.

[0049] When the root password in the login request is consistent with the root password of the current device, it means that the login request is most likely a normal user logging in to the root user on the current device. At this time, the login request is allowed, that is, the initiator of the login request is allowed to log in to the root user, and the response information of the root user login can be fed back to the initiator.

[0050] S24: The login request is rejected.

[0051] When the root password in the login request is inconsistent with the root password of the current device, it means that the login request is likely to be obtained by the attacker from another device, and the attacker attempts to log in to the root user of the current device. In this case, the login request is rejected.

[0052] When the device rejects the login request, it can feed back a response message to the initiator to remind the initiator that the device does not allow remote login to the root user. If the initiator is an attacker, it will make the attacker think that the current device attaches great importance to security protection, and the attacker can give up the idea of ​​continuing to attack the current device, thus ensuring the security of the device from another perspective. If the initiator is a normal user, it can serve as a reminder to the user so that the user can use other methods to log in to the root user, so that the device can be put into normal business. It is also possible to not give any feedback to the initiator, so that the initiator mistakenly believes that the network is abnormal and gives up the idea of ​​attacking the current device.

[0053] From the above content, it can be seen that the method for controlling root user login provided in the embodiment of the present application configures different root passwords for different devices. After the current device receives a login request, it verifies the root password in the request through its unique root password, and rejects the login request when the verification fails. This can prevent attackers from using the root passwords of other devices to log in to the root user of the current device. Even if the root password of one device is leaked, it will not cause a security threat to other devices in the same batch, thereby improving the security of the device.

[0054] Furthermore, as a Figure 2 As a refinement and extension of the method shown, an embodiment of the present application also provides a method for controlling root user login.

[0055] Figure 3 The following is a flow chart of the method for controlling the login of the root user in the embodiment of the present application. Figure 2 , see Figure 3 As shown, the method may include:

[0056] S31: Configure information to prohibit remote login to the root user.

[0057] At present, attackers often use the SSH protocol to remotely log in to the root user of the device. In order to prevent attackers from remotely logging in to the root user of the current device, you can configure relevant prohibition information in the current device. In the specific configuration process, you can configure a prohibition rule. In the prohibition rule, it is stipulated that all requests received by the device need to match the characteristics of remote login to the root user to determine whether the request is a request to remotely log in to the root user. You can also modify the configuration file of the device so that the device prohibits remote login to the root user.

[0058] When modifying the configuration file, you can directly adjust the configuration parameters of the device to prohibit SSH remote login to the root user. There is no need to conduct in-depth research on the behavioral characteristics of attackers logging in to the root user. You can easily and conveniently disable SSH remote login to the root user.

[0059] When adjusting the configuration parameters of the device, you can directly set the parameter DenyUsers root in / etc / ssh / sshd_config. Of course, the specific modification location and parameters vary slightly depending on the system in the device.

[0060] S32: Generate a root password for the current device.

[0061] The root password configured for the current device must be different from the root passwords of other devices. Before the device leaves the factory, the manufacturer will add an identifier to each device in order to distinguish between them. After the device leaves the factory and is delivered to the enterprise, the enterprise will also add an identifier to each device for the convenience of device management. The identifier here is the unique hardware identifier. For manufacturers, the unique hardware identifier can be the unique hardware serial number. For enterprises, the unique hardware identifier can be the management number of the device in the enterprise.

[0062] Specifically, the above step S32 may include:

[0063] Step A1: Get the unique hardware identifier of the current device.

[0064] The unique hardware ID of the current device can be obtained by viewing it on the device or from the device management list.

[0065] After obtaining the hardware unique identifier of the current device, the preset first algorithm may be directly used to process the hardware unique identifier to obtain a root password generated for the current device.

[0066] The unique hardware identifier of the device is directly used as the root password. Since the device will be accessed by different people at different stages, the unique hardware identifier of the device can be easily obtained by others, which makes the root password of the device easy to crack. Therefore, the unique hardware identifier needs to be processed using a preset algorithm before being used as the root password.

[0067] The first algorithm here may refer to any method that can change data, such as the Message Digest 5 (MD5) algorithm, or a method of adding numbers at two specified positions in a string.

[0068] The preset algorithms are frequently used algorithms. Once they are cracked by attackers, the root password will also be cracked if the hardware unique identifier of the device is obtained. In order to increase the difficulty of cracking the root password and ensure the security of the root password, when generating the root password of the device, in addition to using the hardware unique identifier of the device, the software unique identifier of the device can also be combined.

[0069] Step A2: Obtain the software unique identifier of the current device.

[0070] The software unique identifier may refer to the unique identifier of the system installed in the device, such as the system's software certificate serial number, or may refer to the name, icon, software certificate serial number, etc. of a certain application, some applications, or all applications installed in the device.

[0071] After obtaining the hardware unique identifier and software unique identifier of the device, there is only one root password, so it is necessary to merge the obtained hardware unique identifier and software unique identifier.

[0072] Step A3: Use a preset second algorithm to process the hardware unique identifier and the software unique identifier to obtain a root password generated for the current device.

[0073] The second algorithm here can be the same algorithm as the first algorithm mentioned above, for example, the MD5 algorithm, or can be an algorithm different from the first algorithm mentioned above, for example, various algorithms for merging two data into one data.

[0074] S33: configure the root password generated for the current device as the default root password, or modify the default root password of the current device to the root password generated for the current device.

[0075] Previously, all devices in the same batch used the default root password. The root password of each device was the same. If the root password of one device was leaked, the root passwords of all devices in the batch would be leaked, reducing the security of the device. In order to improve the security of the device, different root passwords can be configured for different devices.

[0076] In the process of configuring different root passwords for different devices, before each device leaves the factory, when configuring the default root password for each device, instead of configuring the same root password for each device, a unique root password can be configured for each device. After each device leaves the factory, the default root password for each device will be different. Alternatively, after each device leaves the factory and has been delivered to the user, the default consistent root passwords in each device can be modified to a unique root password for each device. The timing of configuring a unique root password for each device can be determined based on the actual production conditions of each device. When the production conditions are good, a unique root password can be configured before the device leaves the factory. When the production conditions are average, a unique root password can be configured when the device is in use.

[0077] To configure or modify the root password in the device, you can use various existing methods to modify the root password, such as: using the passwd command, using the user management tool, using the Live CD, etc.

[0078] S34: Output the root password of the current device.

[0079] After the unique root password of the current device is generated, the root password will be stored in the device and will only be output when the relevant personnel need to obtain the root password. The root password cannot be output at will and needs to be prevented from being obtained by attackers. Attackers usually steal information remotely, so the root password can be restricted to be output locally only.

[0080] Specifically, the above step S34 may include:

[0081] Step B1: Determine whether the current device is physically connected to a terminal. If yes, execute step B2; if no, execute step B3.

[0082] In other words, it is necessary to determine whether a terminal is connected to the current device via a data cable. For normal users of the device, they can enter the computer room where the device is located, but attackers will not have the opportunity to enter the computer room. Therefore, normal users can connect the terminal and the device with a data cable, and thus obtain the root password of the current device through the terminal. However, because attackers cannot enter the computer room, they cannot connect the terminal and the device with a data cable, and thus cannot obtain the root password of the current device.

[0083] When judging, the current device can detect whether there is a terminal access signal, and judge whether the terminal is connected through a wire by the data characteristics of the signal. If yes, it is determined that the current device is physically connected to the terminal. Instruction information can also be input into the current device to instruct the current device to output specified information to the physically connected terminal. That is, the current device determines whether it receives the instruction information and whether it successfully sends the specified information. If yes, it is determined that the current device is physically connected to the terminal.

[0084] Step B2: Output the root password of the current device to the terminal.

[0085] When it is determined that the current device is physically connected to a terminal, it means that a normal user enters the computer room and connects the terminal to the current device through a data cable. The root password of the current device needs to be obtained. At this time, if the current device has a display function, the current device can display the root password. Because the current device has disabled the function of remotely logging in to the root user, attackers will no longer consider stealing the root password remotely. The current device displays the root password, which is safe and reliable. If the current device does not have a display function, or a terminal display is required, the terminal can display the root password. That is, the current device sends the root password to the terminal for display. In this way, normal users can learn the root password of the current device.

[0086] When the root password of the current device is displayed on the terminal, the current device may send the root password to the input device of the terminal, and the input device of the terminal inputs the password in the terminal, and then the root password is displayed on the display of the terminal. In this way, the root password is transmitted between the current device and the terminal in a physical manner, which can reduce the risk of the root password being intercepted and improve the security of the root password transmission.

[0087] Specifically, the terminal includes a display and an input device. The display generally does not store information. After receiving a signal, it directly displays the corresponding content of the signal. Attackers generally do not consider attacking the display. Input devices can refer to keyboards, mice, etc. Input devices generally do not store information. Therefore, attackers generally do not consider attacking input devices.

[0088] Specifically, the above step B2 may include:

[0089] Step B21: output the root password of the current device to the input device of the terminal, so that the input device transmits the received root password to the display for display.

[0090] When the current device sends the root password to the input device of the terminal, the current device can input the root password in the input device through the robot's operation behavior, or play the audio with the root password through the player. The audio may not be the original content of the root password, but the content of the root password that is improved as agreed in advance between the current device and the terminal. The input device acts as a microphone or other sound receiving device to obtain the audio, and then parses the audio in the terminal to obtain the root password, and then displays the root password on the display.

[0091] Step B3: Keep the root password stored in the current device.

[0092] When it is determined that the current device is not physically connected to the terminal, it means that no normal user has obtained the root password of the current device. At this time, the current device only needs to maintain normal storage of the root password.

[0093] S35: Receive a login request from the root user.

[0094] S36: Determine whether the login request is a remote login request. If yes, execute S37; if no, execute S38.

[0095] After the device receives the login request, since the login request is for the root user and the device does not allow remote login to the root user, it is necessary to determine whether the login request is a remote login request.

[0096] In the specific judgment process, the address of the sender can be obtained from the login request, and then it can be judged whether the address is the address in the device. If not, it can be judged that the login request is a remote login request. Otherwise, it is not a remote login request. It is also possible to judge whether the login request is a remote login request based on the data features in the login request. Because there may be some differences in the content between a remote login request and an ordinary login request, for example: a remote login request generally carries a remote data transmission protocol, the features of these differences can be summarized, and then the login request received by the device is matched with these features. If the match is successful, it can be judged that the login request is a remote login request. Otherwise, it is not a remote login request.

[0097] Of course, since the option of prohibiting remote login is pre-configured in the configuration file of the current device, the remote login request will be directly rejected after reaching the current device.

[0098] S37: The login request is rejected.

[0099] When it is determined that the login request received by the device is a remote login request, and the login request is for the root user, and for the security of the device, remote login to the root user is prohibited in the device, so the device needs to reject the login request.

[0100] S38: Determine whether the root password is the root password of the current device. If yes, execute S39; if no, execute S37.

[0101] When it is determined that the login request received by the device is not a remote login request, the login request cannot be directly allowed to pass because the attacker may have disguised the remote login request so that it cannot be identified as a remote login request. At this time, it is necessary to continue to determine whether the root password in the login request is consistent with the root password of the current device.

[0102] S39: Allow the login request.

[0103] At this point, the method for controlling root user login provided in the embodiment of the present application has been fully described.

[0104] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application also provides a device for controlling root user login.

[0105] Figure 4 The structure of the device for controlling the root user login in the embodiment of the present application is shown as follows: Figure 1 , see Figure 4As shown, the device may include: a receiving module 41, a judging module 42, a allowing module 43 and a rejecting module 44. The receiving module 41, the judging module 42 and the rejecting module 44 are connected in sequence, and the allowing module 43 is connected to the judging module 42.

[0106] The receiving module 41 is used to receive a login request from a root user, wherein the login request includes a root password.

[0107] The judging module 42 is used to judge whether the root password is the root password of the current device, wherein different devices have different corresponding root passwords. If yes, the permission module 43 is entered; if no, the rejection module 44 is entered.

[0108] The allowing module 43 is used to allow the login request.

[0109] The rejection module 44 is used to reject the login request.

[0110] Furthermore, as a Figure 4 As a refinement and extension of the system shown, an embodiment of the present application also provides a device for controlling root user login.

[0111] Figure 5 The structure of the device for controlling the root user login in the embodiment of the present application is shown as follows: Figure 2 , see Figure 5 As shown, the device may include: a first configuration module 51, a password generation module 52, a second configuration module 53, a password output module 54, a receiving module 55, a first judgment module 56, a rejection module 57, and a second judgment module 58. The first configuration module 51, the password generation module 52, the second configuration module 53, the password output module 54, the receiving module 55, the first judgment module 56, the rejection module 57, and the second judgment module 58 are connected in sequence. The second judgment module 58 is connected to the first judgment module 56.

[0112] The first configuration module 51 is used to configure information for prohibiting remote login of the root user.

[0113] The password generation module 52 includes: a hardware identification acquisition unit 521, a software identification acquisition unit 522 and a password calculation unit 523. The hardware identification acquisition unit 521, the software identification acquisition unit 522 and the password calculation unit 523 are connected in sequence.

[0114] The hardware identification acquisition unit 521 is used to acquire the unique hardware identification of the current device.

[0115] The password calculation unit 523 is used to process the hardware unique identifier using a preset first algorithm to obtain a root password generated for the current device.

[0116] The software identification acquisition unit 522 is used to acquire the unique software identification of the current device.

[0117] The password calculation unit 523 is used to process the hardware unique identifier and the software unique identifier using a preset second algorithm to obtain a root password generated for the current device.

[0118] The second configuration module 53 is used to configure the root password generated for the current device as a default root password, or to modify the default root password of the current device to the root password generated for the current device, wherein different root passwords correspond to different devices.

[0119] The password output module 54 includes: a connection determination unit 541, a password output unit 542 and a password holding unit 543. The connection determination unit 541 is connected to the password output unit 542 and the password holding unit 543 respectively.

[0120] The connection determination unit 541 is used to determine whether the current device is physically connected to a terminal. If yes, the process proceeds to the password output unit 542. If no, the process proceeds to the password retention unit 543.

[0121] The password output unit 542 is used to output the root password of the current device to the terminal.

[0122] In the case where the terminal includes a display and an input device, the password output unit 542 is specifically used to output the root password of the current device to the input device of the terminal, so that the input device transmits the received root password to the display for display.

[0123] The password holding unit 543 is used to maintain the root password stored in the current device.

[0124] The receiving module 55 is used to receive a login request for the root user, wherein the login request includes a root password.

[0125] The first judgment module 56 is used to judge whether the login request is a remote login request; if so, the process enters the rejection module 57 , and if not, the process enters the second judgment module 58 .

[0126] The rejection module 57 is used to reject the login request.

[0127] The second judgment module 58 is used to judge whether the root password is the root password of the current device, wherein different devices correspond to different root passwords; if so, enter the permission module 59; if not, enter the rejection module 57.

[0128] The allowing module 59 is used to allow the login request.

[0129] It should be noted here that the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0130] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 6 This is a schematic diagram of the structure of the electronic device in the embodiment of the present application, see Figure 6 As shown, the electronic device may include: a processor 61, a memory 62, and a bus 63; wherein the processor 61 and the memory 62 communicate with each other via the bus 63; the processor 61 is used to call program instructions in the memory 62 to execute the methods in one or more of the above embodiments.

[0131] It should be noted that the description of the above electronic device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the electronic device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.

[0132] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium, which may include: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.

[0133] It should be noted here that the description of the above storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the storage medium embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0134] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for controlling root user login, characterized in that: The method comprises: Receive a login request from a root user, wherein the login request includes a root password; Determine whether the root password is the root password of the current device, where different devices have different root passwords. If not, the login request is rejected.

2. The method according to claim 1, characterized in that Before receiving a login request from the root user, the method further includes: Configure the root password generated for the current device as the default root password, or change the default root password of the current device to the root password generated for the current device.

3. The method according to claim 2, characterized in that Before configuring the root password generated for the current device as the default root password, or before modifying the default root password of the current device to the root password generated for the current device, the method further includes: Get the unique hardware identifier of the current device; The hardware unique identifier is processed using a preset first algorithm to obtain a root password generated for the current device.

4. The method according to claim 2, characterized in that: Before configuring the root password generated for the current device as the default root password, or before modifying the default root password of the current device to the root password generated for the current device, the method further includes: Get the hardware unique identifier and software unique identifier of the current device; The hardware unique identifier and the software unique identifier are processed using a preset second algorithm to obtain a root password generated for the current device.

5. The method according to any one of claims 1 to 4, characterized in that Before receiving a login request from the root user, the method further includes: Determine whether the current device is physically connected to a terminal; If yes, the root password of the current device is output to the terminal.

6. The method according to claim 5, characterized in that The terminal includes a display and an input device; and outputting the root password of the current device to the terminal includes: The root password of the current device is output to the input device of the terminal, so that the input device transmits the received root password to the display for display.

7. The method according to any one of claims 1 to 4, characterized in that Before determining whether the root password is the root password of the current device, the method further includes: Determining whether the login request is a remote login request; If yes, reject the login request; If not, the step of determining whether the root password is the root password of the current device is performed.

8. A device for controlling root user login, characterized in that: The device comprises: A receiving module, used to receive a login request from a root user, wherein the login request includes a root password; A judging module, used to judge whether the root password is the root password of the current device, wherein different devices have different root passwords; if not, entering a rejecting module; The rejection module is used to reject the login request.

9. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a bus; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium comprises: a stored program; wherein, when the program is running, the device where the storage medium is located is controlled to execute the method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Portable and secure automatic password input unit

    CN103136489A

  • Device, system and method for code management

    CN103425921A

  • Mobile phone root password differentiation implementation method based on IMEI / MEID number and applicable mobile phone

    CN103686707A

  • Remote management method and system of password equipment

    CN105141415A

  • One-time authentication method realized by utilization of intelligent hardware

    CN106375304A