A method, device, medium and device for setting account password of embedded Linux device
By using the unique device identifier in the embedded Linux device to calculate the account password and burning it into the device, the problem of device password leakage and user forgetting is solved, and the security and management of account passwords are improved.
Patent Information
- Application Number
- CN202410805242.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In embedded Linux devices, the existing technology lacks an easy-to-manage and secure account and password setting method. Especially when the device manufacturer does not want users to enter the Linux system, there is a risk of leaking the fixed password, and the device cannot be used if the user forgets the password. .
During the development process of embedded Linux devices, the unique identifier of the device is used as an encryption factor, the preset hash function and encryption algorithm are used to calculate the account password, and the calculation results are burned into the device to prevent users from setting their own passwords and ensure Each device has a unique account password.
It improves the security and management of account passwords, avoids the risk of information leakage caused by multiple devices using the same password, reduces the situation of users forgetting passwords, and enhances the system security of the device.
Smart Images

Figure CN118378239B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of account password setting, and in particular to a method, device, medium and device for setting an account password for an embedded Linux device. Background Art
[0002] Generally, in Linux systems, any user who needs to use system resources must first apply for an account from the system administrator (root), and then enter the system with this account. The account is paired with an account password, which together form a barrier to prevent other unrelated people from using the system. Therefore, in Linux systems, account password management is crucial, and its leakage will threaten information security.
[0003] For small embedded devices equipped with Linux systems, since they usually do not have external devices such as screens and mice, they can only interact through command lines. If the account password is forgotten, it is impossible to reset the password. Therefore, for such embedded Linux devices, fixed passwords are usually set for their accounts. In addition, such embedded Linux devices are usually special devices that implement certain business functions in a targeted manner, such as time clock machines, medical equipment, etc. After the equipment manufacturer produces the equipment, it generally only hopes that users will use the business functions implemented by such Linux devices, and does not want users to enter the Linux system unless necessary.
[0004] In the prior art, there are two commonly used methods for setting passwords for the accounts used in embedded Linux devices: the first method is to determine the account and password in the firmware compilation when the Linux device is produced, and the account and password can be entered to log in to the Linux system after the device is turned on. However, in this method, multiple Linux devices use a unified password. If the password is leaked, all Linux devices will face the risk of information leakage. The second method is to force the user to set the account password when the Linux device is turned on for the first time. This method can ensure that each device has a different password, but because the account password is set manually, the Linux device will be unusable if the user forgets the password, and the password management is difficult. If the manufacturer does not want the user to set the password after producing the Linux device, this method is not suitable. In summary, there is currently a lack of an account password setting method that is easy to manage and secure. Summary of the invention
[0005] Based on this, it is necessary to provide a method, device, medium and equipment for setting account passwords for embedded Linux devices in response to the above technical problems.
[0006] This manual adopts the following technical solutions:
[0007] This manual provides a method for setting an account and password for an embedded Linux device, including:
[0008] During the development of the embedded Linux device, a calculation method for calculating the account password based on the device unique identifier of the embedded Linux device is burned into the embedded Linux device;
[0009] The embedded Linux device is powered on, and the obtained account password is set as the account password of the Linux system in the embedded Linux device through the calculation method of the running account password of the embedded Linux device;
[0010] The calculation method of the account password includes:
[0011] The device unique identifier of the embedded Linux device is used as an encryption factor of the account password, and the encryption factor is converted into a hash value corresponding to the device unique identifier through a preset hash function;
[0012] The unique device identifier of the embedded Linux device is used as plain text, and a preset encryption algorithm is used to encrypt the plain text based on a key determined by a hash value, and the encrypted ciphertext is obtained as the account password of the embedded Linux device.
[0013] Optionally, the hash function includes: any one of an MD5 message digest algorithm, an MD4 message digest algorithm or a hash algorithm.
[0014] Optionally, determining the key by the hash value specifically includes:
[0015] The preset rearrangement algorithm is used to arrange and combine the hash values, and the rearranged hash values are used as the key.
[0016] Optionally, the encryption algorithm includes: any one of an RSA algorithm, a DSA algorithm or an AES algorithm.
[0017] Optionally, the step of using a preset encryption algorithm to perform encryption based on a key determined by a hash value, and obtaining a ciphertext obtained after encryption as an account password of the embedded Linux device specifically includes:
[0018] Using a preset encryption algorithm based on a key determined by a hash value, the plaintext is encrypted to obtain an encrypted ciphertext;
[0019] The encrypted ciphertext is arranged and combined using a preset rearrangement algorithm, and the rearranged ciphertext is used as the account password of the embedded Linux device.
[0020] Optionally, the method further comprises:
[0021] When the embedded Linux device is turned on, the calculation method of the embedded Linux device running account password is used to determine whether the calculation result is the same as the preset account password. If not, the calculation result is reset as the Linux system account password of the embedded Linux device.
[0022] This specification provides an embedded Linux device account password setting device, including:
[0023] A burning module, used for burning a calculation method for calculating an account password based on a device unique identifier of the embedded Linux device into the embedded Linux device during the development of the embedded Linux device;
[0024] A setting module is used to power on the embedded Linux device, and set the obtained account password as the account password of the Linux system in the embedded Linux device through the calculation method of the embedded Linux device running account password;
[0025] The calculation method of the account password includes: using the device unique identifier of the embedded Linux device as an encryption factor of the account password, converting the encryption factor into a hash value corresponding to the device unique identifier through a preset hash function; using the device unique identifier of the embedded Linux device as plain text, using a preset encryption algorithm to encrypt based on a key determined by the hash value, and obtaining the encrypted ciphertext as the account password of the embedded Linux device.
[0026] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned method for setting an account password for an embedded Linux device is implemented.
[0027] This specification provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for setting an account password for an embedded Linux device when executing the program.
[0028] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0029] The present invention uses the unique identifier of the embedded Linux device as an encryption factor of the account password, obtains a key based on the encryption factor, and then encrypts the unique identifier of the embedded Linux device as plain text through the key, thereby obtaining the account password corresponding to the embedded Linux device, avoiding the use of the same account password by multiple different embedded Linux devices, and improving the security of the account password; subsequently, the calculation method of the account password is burned into the embedded Linux device, and the embedded Linux device is powered on, and the calculation method of the account password is run by the embedded Linux device, and the calculation result is set as the account password of the Linux system in the embedded Linux device, so that the user does not need to set the password by himself, avoids the situation that the user forgets the password, and improves the manageability of the account password. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0031] Figure 1 A flowchart of a method for setting an account and password for an embedded Linux device provided in this manual;
[0032] Figure 2 A schematic diagram of account password setting and application process provided in this manual;
[0033] Figure 3 A schematic diagram of the key production process provided in this manual;
[0034] Figure 4 A flowchart of the account password creation process provided in this manual;
[0035] Figure 5 A schematic diagram of an embedded Linux device account password setting device provided in this manual;
[0036] Figure 6 A schematic diagram of a computer device for implementing a method for setting an account password for an embedded Linux device provided in this specification. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this application will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in the specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] The Linux system is a multi-user, multi-tasking, time-sharing operating system. Any user who needs to use system resources must first apply for an account from the system administrator (root), and then enter the system with this account. The account is paired with an account password, which together form a barrier to prevent other unrelated people from using the system. Therefore, in the system, account password management is crucial, and its leakage will threaten information security.
[0039] At present, small embedded devices equipped with Linux systems can only interact through command lines. However, if you need to interact through command lines, you must first enter the correct account password to log in to the system. Therefore, such embedded Linux devices do not have the function of resetting passwords. For such embedded Linux devices, fixed passwords are the most common way to set account passwords.
[0040] In addition, after the production of embedded Linux devices, the device manufacturer generally only wants users to use the business functions realized by such Linux devices, and does not want users to enter the Linux system when necessary. For example, for clock-in devices, the device manufacturer only wants users to use the clock-in function and does not want users to enter the system, so they will add an account to the system. Without the account password, users cannot enter the system to perform other operations, in order to avoid the risk of losing system-level data files due to random entry into the system.
[0041] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0042] Figure 1 This is a flowchart of a method for setting an account password for an embedded Linux device in this manual, which specifically includes the following steps:
[0043] S101: During the development of the embedded Linux device, a calculation method for calculating an account password based on a unique device identifier of the embedded Linux device is burned into the embedded Linux device.
[0044] S102: Power on the embedded Linux device, and set the obtained account password as the account password of the Linux system in the embedded Linux device by running the account password calculation method of the embedded Linux device. The account password calculation method includes: using the device unique identifier of the embedded Linux device as an encryption factor of the account password, converting the encryption factor into a hash value corresponding to the device unique identifier through a preset hash function, using the device unique identifier of the embedded Linux device as plain text, using a preset encryption algorithm to encrypt based on a key determined by the hash value, and obtaining the encrypted ciphertext as the account password of the embedded Linux device.
[0045] In order to prevent users from setting account passwords for embedded Linux devices by themselves, during the development of embedded Linux devices, account passwords for Linux system users can be set, wherein the account passwords can be preset based on the unique device identifier of the embedded Linux device.
[0046] Specifically, during the development phase of an embedded Linux device, the server can write the account password calculation process into the system code and integrate it with the system through compilation, thereby preventing it from being placed separately and being separated by the outside. The server can then burn the integrated system code and account password calculation method into the embedded Linux device.
[0047] Afterwards, the embedded Linux device can be powered on. When the embedded Linux device is turned on for the first time, the embedded Linux device will run the calculation method of the account password burned into the device, and set the calculated result as the account password of the Linux system in the embedded Linux device, thereby completing the setting of the account password of the embedded Linux device.
[0048] The server mentioned in this specification can be a server set up on a business platform, or a device such as a desktop computer, a laptop computer, etc. that can execute the solution of this specification. For the convenience of description, the following description is based on the server as the execution subject.
[0049] Subsequently, when the user uses the embedded Linux device, in one or more embodiments of the present specification, after the embedded Linux device is powered on, the embedded Linux device may first obtain the device unique identifier, and determine whether the calculation result is the same as the preset account password by running the calculation method of the local machine. The embedded Linux device may then enter a normal startup process and provide the user with corresponding functional services. If they are different, it indicates that the password has been tampered with and further processing is required. For example, the embedded Linux device may be configured to automatically reset the calculation result as the Linux system account password in the embedded Linux device, such as Figure 2 shown.
[0050] Figure 2 This is a schematic diagram of an account password setting and application process in this manual. Figure 2 The part after booting up to get the device number is the process of calculating the account password.
[0051] Regarding the specific calculation method of the account password, generally, when setting the password, the plain text can be encrypted based on a certain encryption algorithm and a determined key. Based on this, in one or more embodiments of this specification, in order to set a one-to-one corresponding account password for an embedded Linux device, the key and the plain text can be determined in advance based on the device unique identifier of the embedded Linux device.
[0052] Therefore, the unique identifier of the embedded Linux device can be used as the encryption factor of the account password. The unique identifier here can refer to a device identifier with unique identification, such as a Universally Unique Identifier (UUID) or a Unique Device Identifier (UDID).
[0053] Then, the key can be calculated based on the encryption factor. For example, the encryption factor can be input into a preset hash function to obtain its corresponding hash value. The hash function can be a combination of one or more of the MD5 message digest algorithm (Message Digest Algorithm MD5), the MD4 message digest algorithm (Message Digest Algorithm MD4) or the hash algorithm. The obtained hash value can be used as the key of the encryption algorithm. The specific hash function to be used can be determined according to needs, and this specification does not limit this.
[0054] Of course, in one or more embodiments of the present specification, the server may further process the hash value obtained above to improve security. For example, the server may use a preset rearrangement algorithm to rearrange the hash value, use the rearranged hash value as the key, and thereby obtain the key from the hash value. By scrambling the characters in the hash value, the difficulty of deciphering the account password is further increased.
[0055] Figure 3 This is a schematic diagram of the process of making a key in this manual. Figure 3 It can be seen that the server can use the Hash algorithm to obtain the corresponding hash value based on the unique device number of the embedded device (that is, the device unique identifier), and then obtain the characters in the hash value according to the agreed rules to reorganize into a new ciphertext as the key for the subsequent encryption algorithm.
[0056] After obtaining the key as described above, the unique device identifier of the embedded Linux device can be used as plain text, and the plain text can be encrypted using a preset encryption algorithm based on the key, and the encrypted cipher text can be used as the account password. The encryption algorithm mentioned here can include one or more combinations of the RSA algorithm, the DSA (Digital Signature Algorithm) algorithm, or the Advanced Encryption Standard (AES) algorithm, etc., which can be determined according to needs, and this manual does not limit this.
[0057] Of course, in one or more embodiments of the present specification, the server can also use a preset encryption algorithm based on a key determined by a hash value to perform encryption calculation on the plaintext to obtain an encrypted ciphertext. The encrypted ciphertext is arranged and combined using a preset rearrangement algorithm, and the rearranged ciphertext is used as the account password of the embedded Linux device. Similarly, rearranging the encrypted ciphertext further increases the difficulty of deciphering the account password and improves the security of the account password.
[0058] Figure 4 This is a flowchart of an account password creation process in this manual. Figure 4 It can be seen that the server can use the unique device number (i.e., the device unique identifier) as plain text, cooperate with the key obtained in the above step, encrypt the plain text using the key through the encryption algorithm, and then use the agreed rules to obtain the characters in the encrypted ciphertext to recompose the new ciphertext as the account password of the embedded Linux device.
[0059] based on Figure 1The method for setting an account password for an embedded Linux device shown in the figure uses the unique identifier of the embedded Linux device as an encryption factor of the account password, obtains a key based on the encryption factor, and then encrypts the unique identifier of the embedded Linux device as plain text through the key, thereby obtaining the account password corresponding to the embedded Linux device, avoiding the use of the same account password by multiple different embedded Linux devices, and improving the security of the account password. Subsequently, the calculation method of the account password is burned onto the embedded Linux device, and the embedded Linux device is powered on. The calculation method of the account password is run by the embedded Linux device, and the calculation result is set as the account password of the Linux system in the embedded Linux device, so that the user does not need to set the password, avoiding the situation where the user forgets the password, and improving the manageability of the account password.
[0060] When using the embedded Linux device account password setting method provided in this manual, you do not need to follow Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and this manual does not limit this.
[0061] In addition, in one or more embodiments of the present specification, when a user needs a password to operate the system of an embedded Linux device, the user can obtain the device unique identifier of the embedded Linux device, obtain the account password through the above-mentioned account password calculation method, and then enter the account password to log in to the Linux system.
[0062] The present invention determines the key and plaintext based on the unique device identifier of the embedded Linux device, thereby performing encryption operations, so that different devices use different passwords, and the risk of information security of all embedded Linux devices will not be caused by the leakage of individual embedded Linux device passwords. On the other hand, the account password is set during the development process of the embedded Linux device, and there is no need to manually set the account password, which avoids the situation of forgetting the account password and reduces the risk of password leakage. In the calculation process of the account password, the complexity of the account password is increased by hashing and reorganization, etc., to prevent brute force cracking, thereby improving the system security of the embedded Linux device.
[0063] The above is an embedded Linux device account password setting method provided by one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding embedded Linux device account password setting device, such as Figure 5 shown.
[0064] Figure 5 A schematic diagram of an embedded Linux device account password setting device provided in this manual includes:
[0065] The burning module 201 is used to burn the calculation method of calculating the account password based on the device unique identifier of the embedded Linux device into the embedded Linux device during the development of the embedded Linux device;
[0066] The setting module 202 is used to power on the embedded Linux device, and set the obtained account password as the account password of the Linux system in the embedded Linux device through the calculation method of the embedded Linux device running account password;
[0067] The calculation method of the account password includes: using the device unique identifier of the embedded Linux device as an encryption factor of the account password, converting the encryption factor into a hash value corresponding to the device unique identifier through a preset hash function; using the device unique identifier of the embedded Linux device as plain text, using a preset encryption algorithm to encrypt based on a key determined by the hash value, and obtaining the encrypted ciphertext as the account password of the embedded Linux device.
[0068] Optionally, the hash function includes: any one of an MD5 message digest algorithm, an MD4 message digest algorithm or a hash algorithm.
[0069] Optionally, determining the key from the hash value includes: using a preset rearrangement algorithm to arrange and combine the hash values, and using the rearranged hash value as the key.
[0070] Optionally, the encryption algorithm includes: any one of an RSA algorithm, a DSA algorithm or an AES algorithm.
[0071] Optionally, a preset encryption algorithm is used to encrypt the plaintext based on a key determined by a hash value to obtain an encrypted ciphertext, and a preset rearrangement algorithm is used to arrange and combine the encrypted ciphertext, and the rearranged ciphertext is used as the account password of the embedded Linux device.
[0072] Optionally, the device also includes: a reset module, which is used to determine whether the calculation result is the same as the preset account password through the calculation method of the embedded Linux device when the embedded Linux device is turned on. If not, the calculation result is reset as the Linux system account password of the embedded Linux device.
[0073] For the specific definition of the embedded Linux device account password setting device, please refer to the definition of the embedded Linux device account password setting method above, which will not be repeated here. Each module in the above-mentioned embedded Linux device account password setting device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0074] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 Provides a method for setting account passwords for embedded Linux devices.
[0075] This manual also provides Figure 6 The structural diagram of the computer device shown in FIG. Figure 6 As shown, at the hardware level, the computer device includes a processor 601, an internal bus 605, a network interface 602, a memory 603, and a non-volatile memory 604, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 Provides a method for setting account passwords for embedded Linux devices.
[0076] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0077] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for setting an account password for an embedded Linux device, characterized in that: include: During the development of the embedded Linux device, a calculation method for calculating the account password based on the unique device identifier of the embedded Linux device is burned into the embedded Linux device; Power on the embedded Linux device, calculate the account password by running the embedded Linux device, and set the obtained account password as the account password of the Linux system in the embedded Linux device; The calculation method of the account password includes: The unique device identifier of the embedded Linux device is used as an encryption factor of the account password, and the encryption factor is converted into a hash value corresponding to the unique device identifier through a preset hash function; The unique device identifier of the embedded Linux device is used as plain text, and a preset encryption algorithm is used to encrypt the plain text based on a key determined by a hash value, and the encrypted ciphertext is obtained as the account password of the embedded Linux device.
2. The method for setting an account password for an embedded Linux device according to claim 1, wherein: The hash function includes: any one of the MD5 information digest algorithm, the MD4 information digest algorithm or the hash algorithm.
3. The method for setting an account password for an embedded Linux device according to claim 1, wherein: Determining the key by the hash value specifically includes: The preset rearrangement algorithm is used to arrange and combine the hash values, and the rearranged hash values are used as the key.
4. The method for setting an account password for an embedded Linux device according to claim 1, wherein: The encryption algorithm includes: any one of the RSA algorithm, the DSA algorithm or the AES algorithm.
5. The method for setting an account password for an embedded Linux device according to claim 1, wherein: The method of using a preset encryption algorithm to perform encryption based on a key determined by a hash value, and obtaining the encrypted ciphertext as the account password of the embedded Linux device, specifically includes: Using a preset encryption algorithm based on a key determined by a hash value, the plaintext is encrypted to obtain an encrypted ciphertext; The encrypted ciphertext is arranged and combined using a preset rearrangement algorithm, and the rearranged ciphertext is used as the account password of the embedded Linux device.
6. The method for setting an account password for an embedded Linux device according to claim 1, wherein: The method further comprises: When the embedded Linux device is turned on, the calculation method of the embedded Linux device running the account password is used to determine whether the calculation result is the same as the preset account password. If not, the calculation result is reset to the Linux system account password of the embedded Linux device.
7. A device for setting an account password for an embedded Linux device, characterized in that: include: A burning module is used to burn a calculation method for calculating an account password based on a unique device identifier of the embedded Linux device into the embedded Linux device during the development of the embedded Linux device; The setting module is used to power on the embedded Linux device, calculate the account password by running the embedded Linux device, and set the obtained account password as the account password of the Linux system in the embedded Linux device; The calculation method of the account password includes: using the device unique identifier of the embedded Linux device as an encryption factor of the account password, converting the encryption factor into a hash value corresponding to the device unique identifier through a preset hash function; using the device unique identifier of the embedded Linux device as plain text, using a preset encryption algorithm to encrypt based on a key determined by the hash value, and obtaining the encrypted ciphertext as the account password of the embedded Linux device.
8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
