A control method and device for remote login

Through the remote login APP, the root directory and the parent process's file node number judgment is used to realize differentiated control of telnet login users, solving the problem of distinguishing between privileged users and third-party users, and ensuring that the file access and operation permissions of third-party users are restricted.

CN112883345BActive Publication Date: 2025-08-01ZHEJIANG DAHUA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110155137.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-04
Publication Date
2025-08-01
Estimated Expiration
2041-02-04

AI Technical Summary

Technical Problem

The prior art cannot differentiate control of telnet login users, especially when privileged users and third-party users can log in to the same account, it cannot distinguish and grant different permissions.

Method used

By designing a remote login APP, obtain the root directory of the application and the file node number of the parent process, determine whether it is started through the shell login of the third-party telnetd, and perform signature verification, resource restrictions and capability settings to achieve differentiated control of third-party users.

Benefits of technology

It realizes the telnet login device capabilities of third-party users, and can differentiate differentiated control of third-party remote login shells from privileged users, ensuring the limitations of file access scope and operation permissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112883345B_ABST
    Figure CN112883345B_ABST
Patent Text Reader

Abstract

The present invention provides a control method and device for remote login. Among them, the method includes: receiving an operation command sent by a client through an application; determining whether the application is started by logging in through the shell of a third-party telnetd; in the case where the determination result is yes, controlling the application started on the shell and responding to the operation command, which can solve the problem in the related art that differential control cannot be performed on telnet login users. By designing a remote login APP, the ability for third-party users to have telnet login to the device is realized, and differential control different from privileged users can be performed on the third-party remote login shell.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of remote control, and in particular to a remote login control method and device. Background Art

[0002] A related art method for implementing a remote shell login in an embedded operating system includes the following steps: adding a remote login command telnet server port component to the embedded operating system component, porting its default Transmission Control Protocol port to another Transmission Control Protocol port, which serves as the port number used by telnet to enter the shell program; adding a start command or end command to the system command line for telnet to call when entering or closing the shell; after telnet logs in to the regular command line, executing the start command to start a background shell task; logging into the shell environment through the command line login port and performing shell operations; and after the operations are completed, executing the end command to close the background shell task. The command line and shell can be used simultaneously, facilitating remote fault handling and function debugging, and accelerating the processing of remote issues.

[0003] When both privileged users and third-party users can log in to the device (especially when logging in with the same account), how to distinguish between privileged users and third-party users and then grant them different permissions is not possible with existing solutions.

[0004] Regarding the problem that related technologies cannot perform differentiated control on Telnet login users, no solution has been proposed yet. Summary of the Invention

[0005] The embodiments of the present invention provide a remote login control method and device, so as to at least solve the problem in the related art that it is impossible to perform differentiated control on Telnet login users.

[0006] According to one embodiment of the present invention, a remote login control method is provided, comprising: receiving an operation command sent by a client through an application; determining whether the application is started through a shell login of a third-party telnetd; and if the determination result is yes, controlling the application started on the shell and responding to the operation command.

[0007] In an exemplary embodiment, determining whether the application is started through a third-party telnetd shell login includes: obtaining a root directory of the application; and determining whether the application is started through a third-party telnetd shell login according to the root directory of the application.

[0008] In an exemplary embodiment, determining whether the application is started by logging in to the shell of a third-party telnet according to the root directory of the application includes: obtaining the parent process of the application and the file node number of the root directory of the application; determining whether the application is started by logging in to the shell of a third-party telnet according to the parent process of the application and the file node number of the root directory of the application.

[0009] In an exemplary embodiment, determining whether the application is started by logging in to the shell of a third-party telnetd according to the parent process of the application and the file node number of the root directory includes: determining whether the parent process of the application includes a telnetd service process; in the case where the determination result is yes, determining whether the file node number of the root directory of the application is different from the file node number of the system root directory; in the case where the determination result is yes, determining that the application is started by the shell of a third-party telnetd.

[0010] In an exemplary embodiment, before obtaining the root directory of the application, the method further includes: reconstructing the root directory of the application for the telnetd service process, where the root directory of the application is a sub-directory of the system root directory, and the root directory of the application is used to store files that can be accessed by the third party.

[0011] In an exemplary embodiment, controlling the application started on the shell includes: performing signature verification on the application started on the shell; performing resource limitation on the application started on the shell; performing capability setting on the application started on the shell.

[0012] According to another embodiment of the present invention, there is also provided a control device for remote login, including: a receiving module, configured to receive an operation command sent by a client through an application; a determining module, configured to determine whether the application is started by logging in to the shell of a third-party telnetd; and a processing module, configured to, in the case where the determination result is yes, control the application started on the shell and respond to the operation command.

[0013] In an exemplary embodiment, the determining module includes:

[0014] an obtaining sub-module, configured to obtain the root directory of the application;

[0015] a determining sub-module, configured to determine whether the application is started by logging in to the shell of a third-party telnetd according to the root directory of the application.

[0016] In an exemplary embodiment, the above-mentioned determination sub-module is further configured to obtain the parent process of the application program and the file node number of the root directory of the application program; and determine whether the application program is started by logging in to the shell through a third-party telnet according to the parent process of the application program and the file node number of the root directory of the application program.

[0017] In an exemplary embodiment, the above-mentioned determination sub-module is further configured to determine whether the telnetd service process is included in the parent process of the application program; in the case where the determination result is yes, determine whether the file node number of the root directory of the application program is different from the file node number of the system root directory; in the case where the determination result is yes, determine that the application program is started through the shell of a third-party telnetd.

[0018] In an exemplary embodiment, the apparatus further includes a reconstruction module, configured to reconstruct the root directory of the application program for the telnetd service process, where the root directory of the application program is a sub-directory of the system root directory, and the root directory of the application program is used to store files that can be accessed by the third party.

[0019] In an exemplary embodiment, the above-mentioned processing module is further configured to perform signature verification on the application program started on the shell; perform resource limitation on the application program started on the shell login; and perform capability setting on the application program started on the shell login.

[0020] According to another embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0021] According to another embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0022] Through the present invention, an operation command sent by a receiving client through an application is received; it is determined whether the application is started by logging in to a shell of a third-party telnetd; in the case where the determination result is yes, the application started on the shell is controlled, and the operation command is responded to, which can solve the problem in the related art that differential control cannot be performed on telnet login users. By designing a remote login APP, the ability for third-party users to have telnet login to a device is realized, and differential control different from privileged users can be performed on the third-party remote login shell. Description of the Drawings

[0023] The drawings described herein are used to provide a further understanding of the present invention, form a part of this application, and the schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0024] Figure 1 It is a hardware structure block diagram of a mobile terminal for a remote login control method according to an embodiment of the present invention;

[0025] Figure 2 It is a flowchart of a remote login control method according to an embodiment of the present invention;

[0026] Figure 3 It is a schematic diagram of a remote login scenario according to an embodiment of the present invention;

[0027] Figure 4 It is a schematic diagram of the remote login process of the existing solution;

[0028] Figure 5 It is a schematic diagram of a remote login process according to an embodiment of the present invention;

[0029] Figure 6 It is a schematic diagram of the remote login APP architecture according to an embodiment of the present invention;

[0030] Figure 7 It is a schematic diagram of the remote login APP installation and startup process according to an embodiment of the present invention;

[0031] Figure 8 It is a schematic diagram of the Telnetd service startup process according to an embodiment of the present invention;

[0032] Figure 9 It is a schematic diagram of the process of an application startup verification module according to an embodiment of the present invention;

[0033] Figure 10 It is a block diagram of a remote login control device according to an embodiment of the present invention. Detailed Embodiments

[0034] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.

[0035] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence.

[0036] Embodiment 1

[0037] The method embodiment provided by the first embodiment of the present application can be executed on a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal for the remote login control method of the embodiment of the present invention. As Figure 1 shown, the mobile terminal may include one or more ( Figure 1 only one is shown in Figure 1 the figure) processors 102 (the processors 102 may include, but are not limited to, processing devices such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the above-mentioned mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown in Figure 1 the figure is only schematic, and it does not limit the structure of the above-mentioned mobile terminal. For example, the mobile terminal may further include more or fewer components than

[0038] shown in

[0039] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the remote login control method in the embodiment of the present invention. The processor 102 executes various functional applications and remote login control by running the computer program stored in the memory 104, that is, the above-mentioned method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories may be connected to the mobile terminal through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0039] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of a mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0040] In this embodiment, a control method for remote login running on the above mobile terminal or network architecture is provided. Figure 2 It is a flowchart of the control method for remote login according to an embodiment of the present invention, as Figure 2 shown. The process includes the following steps:

[0041] Step S202, receiving an operation command sent by a client through an application;

[0042] Step S204, determining whether the application is started by logging in to a shell of a third-party telnetd;

[0043] Step S206, in the case where the determination result is yes, controlling the application started on the shell and responding to the operation command.

[0044] Through the above steps S202 to S206, receiving an operation command sent by a client through an application; determining whether the application is started by logging in to a shell of a third-party telnetd; in the case where the determination result is yes, controlling the application started on the shell and responding to the operation command, the problem in the related art that differential control cannot be performed on telnet login users can be solved. By designing a remote login application APP, the ability of a third-party user to log in to a device via telnet is realized, and differential control different from that of privileged users can be performed on a third-party remote login shell.

[0045] In an optional embodiment, the above step S204 includes: obtaining the root directory of the application; determining whether the application is started by logging in to a shell of a third-party telnetd according to the root directory of the application.

[0046] That is, when determining whether an application is started by logging in to a shell of a third-party telnetd, it is necessary to first obtain the root directory of the application, and then determine whether the application is started by logging in to a shell of a third-party telnetd according to the root directory.

[0047] In an alternative embodiment, determining whether the application is started by logging in through the shell of a third-party telnet based on the root directory of the application includes: obtaining the parent process of the application and the file node number of the root directory of the application; determining whether the application is started by logging in through the shell of a third-party telnet based on the parent process of the application and the file node number of the root directory of the application. In this embodiment, the file node number may specifically be an inode number or an i-node number.

[0048] That is, when determining whether the application is started by logging in through the shell of a third-party telnet based on the root directory of the application, it is necessary to first obtain the parent process of the application and the file node number of the root directory, and determine whether the application is started by logging in through the shell of a third-party telnet based on the two.

[0049] In an alternative embodiment, determining whether the application is started by logging in through the shell of a third-party telnetd based on the parent process of the application and the file node number of the root directory includes: determining whether the parent process of the application contains a telnetd service process; in the case where the determination result is yes, determining whether the file node number of the root directory of the application is different from the file node number of the system root directory; in the case where the determination result is yes, determining that the application is started by the shell of a third-party telnetd.

[0050] That is, first determine whether the parent process of the application contains a telnetd service process. In the case of containment, determine whether the file node number of the root directory is different from the file node number of the system root directory. In the case of difference, it can be determined that the application is started by the shell of a third-party telnetd.

[0051] In an alternative embodiment, before obtaining the root directory of the application, reconstruct the root directory of the application for the telnetd service process, where the root directory of the application is a sub-directory of the system root directory, and the root directory of the application is used to store files that can be accessed by the third party.

[0052] In other words, before obtaining the root directory of the application, it is also necessary to reconstruct the root directory of the application for the telnetd service process, which is used to store files that can be accessed by the third party.

[0053] In an optional embodiment, controlling the application launched on the shell includes: performing signature verification on the application launched on the shell; performing resource restrictions on the application launched on the shell; and setting capability of the application launched on the shell, so as to achieve the purpose of controlling login shell commands.

[0054] That is, to control the shell login of an application, it is necessary to first verify the signature of the shell login of the application, then restrict the resources of the shell login of the application, and set the capabilities of the shell login of the application.

[0055] Figure 3 FIG. 1 is a schematic diagram of a remote login scenario according to an embodiment of the present invention. Figure 3 As shown, it includes: Telnet client, privileged user, and third-party user.

[0056] Among them, privileged users log in to the shell layer through their private username and password, identify the user's cmd command, and determine whether the operation is allowed; third-party users log in to the shell layer through authorized installation of a remote login APP, and similarly, determine whether the operation is allowed by identifying the user's cmd command.

[0057] The above embodiment enables third-party users to have the ability to log in to the device through telnet by designing a remote login APP; implements restrictions on logged-in users, such as: limiting the range of files visible to third-party users by switching the root directory; and can identify the initiator of the operation command, and then decide whether to prohibit or allow the user to execute a certain operation command.

[0058] Among them, by reconstructing the root directory of the telnet login shell, an application inspection module is registered to enter the operating system. This inspection module effectively identifies whether the application command is started through the telnet login of a third-party user by identifying the parent process name and the root directory inode number of the user program one by one.

[0059] Figure 4 This is a flowchart of the remote login process of the existing solution, such as Figure 4 As shown, the following steps are included:

[0060] Step S1, after the system is started, start the telnetd service;

[0061] Step S2: The user terminal initiates a telnet login request;

[0062] Step S3, the telnetd service starts the shell;

[0063] Step S4, the user terminal initiates a login request;

[0064] Step S5, the shell program starts the application;

[0065] Step S6, the application initiates system processing through the exec function.

[0066] Specifically, first, the device - side system starts the telnetd service; when the user initiates a login request on the client, the telnetd service on the device - side starts the shell; the user logs in to the shell on the device - side for operations such as starting the application; the application startup process is handled by the operating system.

[0067] Figure 5 It is a schematic diagram of the remote login process according to an embodiment of the present invention. As Figure 5 shown, it includes the following steps:

[0068] Step S1, the user terminal installs and starts the APP;

[0069] Step S2, switch to the root directory and start the telenet service;

[0070] Step S3, register / start verifying the user identity;

[0071] Step S4, the user terminal makes a telnet login request;

[0072] Step S5, the telnet service starts the shell;

[0073] Step S6, the user terminal performs a login operation;

[0074] Step S7, the shell starts the application;

[0075] Step S8, the application initiates system processing through the exec function;

[0076] Step S9, enter system processing.

[0077] Compared with the prior art, the above embodiments add a remote login APP: the telnetd service is managed through this APP, and this APP is installed and started by the user; redefine the startup method of the telnetd service: perform a root directory switching operation before the telnetd service starts; the main function of the root switching operation is to control the file scope visible to third-party login users. Since the initial root directory of the telnet login shell is the files visible to privileged users, all files are open to the outside world. To limit the file scope visible to third-party users, the remote login APP constructs a new root for third-party users, and only files that can be opened to customers exist in the new root; the application program verification includes the following features: First, the remote login APP is registered into the operating system when it starts; Second, because the application program verification is registered into the operating system, the application programs started by privileged users and third-party users through the telnet login shell will be verified first, and it can be identified which one of the privileged users and third-party users starts the application program; Third, support the remote login APP to turn it on and off; (If it is turned on, the application programs started on the shell will go through the verification process; if it is turned off, the application programs will skip the verification process and directly enter the standard process of the operating system for startup).

[0078] Figure 6 It is a schematic diagram of the remote login APP architecture according to an embodiment of the present invention, as Figure 6 shown: Package the APP main program, Telnetd service program, and application program verification into one APP.

[0079] Figure 7 It is a schematic diagram of the remote login APP installation and startup process according to an embodiment of the present invention, as Figure 7 shown, including the following steps:

[0080] Step S1, decompress the installation package;

[0081] Step S2, start the remote login APP main program;

[0082] Step S3, start the verification and register it into the system;

[0083] Step S4, start the Telnetd service.

[0084] Specifically, the installation process of the remote login APP: decompress each component introduced in Section 5.2.1 and start the APP main program; APP main program: responsible for loading the verification and starting the Telnetd service program; Telnetd service program: start this Telnetd service program in the APP main program; Application program verification: register the verification into the system in the APP main program, and start to check the application program process after the application program starts and before the operating system loads the code segment.

[0085] Figure 8 is a schematic diagram of the Telnetd service startup process according to an embodiment of the present invention, as Figure 8 shown, including the following steps:

[0086] Step S1, start the remote login APP to create a child process;

[0087] Step S2, construct the root directory;

[0088] Step S3, switch the root directory of the child process;

[0089] Step S4, start the telnetd service.

[0090] Specifically, a child process is created when the main program of the login APP starts; note: this child process inherits the root directory of the system shell (init startup); construct the root directory: the main program of the APP reconstructs the root directory for the telnetd service process, and the reconstructed root directory is a subdirectory of the system root directory and serves as the root after a third-party user logs in. At this time, the privileged user logs in with the system root directory as the root, and the third-party user logs in with a subdirectory of the system root directory as the root, and the file scopes seen by the two users are obviously different; among them, when logging in via telnet later, the login shell inherits the root directory of its parent process telnetd; construction method: create a new directory: / system root directory / newroot / . Switch the root directory of the created child process to the created directory: / system root directory / newroot. Start the Telnetd service in the created child process. Note: At this time, the Telnetd service process uses / newroot as the root directory, and when logging in via telnet later, the login shell inherits the root directory of this telnetd.

[0091] Figure 9 is a schematic diagram of the application program startup verification process according to an embodiment of the present invention, as Figure 9 shown, including the following steps:

[0092] Step S1, the application program starts;

[0093] Step S2, the application program enables the verification function;

[0094] Step S3, determine whether the parent process contains telnetd;

[0095] Step S4, Inode number determination;

[0096] Step S5, set the application program capability;

[0097] Step S6, the standard application program startup process of the operating system.

[0098] Specifically, the startup of the application in this embodiment needs to be verified by the application first. The APP is registered into the operating system by remote login. Once the registration is successful, the application launched by either a privileged user or a third-party user will be verified. The parent process determination and Inode number judgment criteria include:

[0099] First, a third-party user installed a designed remote login app to access the device, and the device was responsible for launching the remote login app.

[0100] Because the device uses the system shell to start the remote login app, and the system shell process uses the system root directory as its root, the remote login app inherits the system root directory.

[0101] Second, at this point the remote login APP main program starts with the system root directory as the root.

[0102] The remote login app creates a child process during startup and builds a new directory within the child process (the new directory is a subdirectory of the system root directory; obviously, the root directory and its subdirectories have different file ranges). The root of the child process created by the remote login app is switched to the new directory, and the telnetd service is started in the child process. This means that the telnetd service inherits the new directory as its root. The third-party login shell is started by the telnetd service, so the root of this shell is also the new directory.

[0103] Note that the system root directory and the new directory are different directories, and the two directories have different inode numbers.

[0104] Third, remotely log in to the root directory of the APP process:

[0105] The system shell starts (with the system root directory as the root) -> remote login APP (with the system root directory as the root) -> remote login APP child process switches the root directory (with the new directory as the root) -> starts the telnetd process (with the new directory as the root) -> a third-party user logs in to the shell started by this telnetd (with the new directory as the root) -> the third-party user starts the application (with the new directory as the root) after logging in to the shell.

[0106] Among them, user applications and their parent processes always use the system root directory as the root.

[0107] Parent-child relationship: -> direction indicates its parent process.

[0108] Application started by a third party -> shell started by telnetd -> remote login APP child process -> remote login APP -> system shell.

[0109] Determination of the parent process: For an application program started by a third-party user, its parent process is the telnetd process. If the telnetd process is included in the parent process, the inode number is further verified; otherwise, it is executed according to the standard process of the operating system for starting the application program.

[0110] Inode number determination: The application program started by the third-party user has a new directory as the root, but the remote login APP in its parent process has the system root directory as the root, and both the privileged user process and its parent process have the system root directory as the root. Therefore, if the inode number of the application program root directory is different from that of the root directory of its parent process, the application program is started by the third-party user through the remote login shell of this technical solution, and thus the application program started by the third-party user is determined.

[0111] Setting capability: This step is an example of additional operations that can be performed after identifying the third party.

[0112] Standard application program startup process of the operating system: Login users other than the identified third-party users (which can include the system shell, ssh login shell, and telnet login shell of the privileged user).

[0113] Embodiment 2

[0114] According to another embodiment of the present invention, a control device for remote login is further provided. Figure 10 It is a block diagram of the control device for remote login according to the embodiment of the present invention, as Figure 10 shown, including:

[0115] A receiving module 102, configured to receive an operation command sent by a client through an application program;

[0116] A determination module 104, configured to determine whether the application program is started by logging in through the shell of a third-party telnetd;

[0117] A processing module 106, configured to control the application program started on the shell and respond to the operation command when the determination result is yes.

[0118] Optionally, the determination module 104 includes: an acquisition sub-module, configured to acquire the root directory of the application program; a determination sub-module, configured to determine whether the application program is started by logging in through the shell of a third-party telnetd according to the root directory of the application program.

[0119] That is, when determining whether the application is started by logging in through the shell of the third-party telnetd, it is necessary to first obtain the root directory of the application, and then determine whether the application is started by logging in through the shell of the third-party telnetd based on the root directory.

[0120] Optionally, the above determination sub-module is further configured to obtain the parent process of the application and the file node number of the root directory of the application; determine whether the application is started by logging in through the shell of the third-party telnet based on the parent process of the application and the file node number of the root directory of the application.

[0121] That is, when determining whether the application is started by logging in through the shell of the third-party telnet based on the root directory of the application, it is necessary to first obtain the parent process of the application and the file node number of the root directory, and determine whether the application is started by logging in through the shell of the third-party telnet based on the two.

[0122] Optionally, the above determination sub-module is further configured to determine whether the telnetd service process is included in the parent process of the application; in the case where the determination result is yes, determine whether the file node number of the root directory of the application is different from the file node number of the system root directory; in the case where the determination result is yes, determine that the application is started through the shell of the third-party telnetd.

[0123] That is, first determine whether the telnetd service process is included in the parent process of the application. In the case where it is included, determine whether the file node number of the root directory is different from the file node number of the system root directory. In the case where it is different, it can be determined that the application is started through the shell of the third-party telnetd.

[0124] Optionally, the above determination module 104 is further configured to: reconstruct the root directory of the application for the telnetd service process, where the root directory of the application is a sub-directory of the system root directory, and the root directory of the application is used to store files that can be accessed by the third party.

[0125] In other words, before obtaining the root directory of the application, it is also necessary to reconstruct the root directory of the application for the telnetd service process, which is used to store files that can be accessed by the third party.

[0126] Optionally, the above processing module is further configured to perform signature verification on the application started on the shell; perform resource limitation on the application started on the shell; perform capability setting on the application started on the shell.

[0127] That is, to control the shell login of the application, it is necessary to first perform signature verification on the shell login of the application, then perform resource restrictions on the shell login of the application, and perform capability settings on the shell login of the application.

[0128] It should be noted that the above-mentioned modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules are respectively located in different processors in any combination.

[0129] Embodiment 3

[0130] An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program is stored. Among them, the computer program is set to execute the steps in any one of the above method embodiments when running.

[0131] Optionally, in this embodiment, the above storage medium can be set to store a computer program for executing the following steps:

[0132] S1, receiving an operation command sent by a client through an application;

[0133] S2, determining whether the application is started through the shell login of a third-party telnetd;

[0134] S3, when the determination result is yes, controlling the application started on the shell and responding to the operation command.

[0135] Optionally, in this embodiment, the above storage medium may include but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.

[0136] Embodiment 4

[0137] An embodiment of the present invention also provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is set to run the computer program to execute the steps in any one of the above method embodiments.

[0138] Optionally, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0139] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0140] S1. Receive an operation command sent by a client through an application;

[0141] S2. Determine whether the application is started by logging in to the shell of a third-party telnetd;

[0142] S3. When the determination result is yes, control the application started on the shell and respond to the operation command.

[0143] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated herein.

[0144] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. Thus, the present invention is not limited to any specific combination of hardware and software.

[0145] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A control method for remote login, characterized in that, Including: Receiving an operation command sent by a client through an application; Determining whether the application is started by logging in to a shell of a third-party telnetd, including: obtaining the root directory of the application; obtaining the parent process of the application and the file node number of the root directory of the application; determining whether the application is started by logging in to a shell of a third-party telnet based on the parent process of the application and the file node number of the root directory of the application; When the determination result is yes, controlling the application started on the shell and responding to the operation command; Wherein, controlling the application started on the shell includes: Performing signature verification on the application started on the shell; Performing resource limitation on the application started on the shell; Performing capability setting on the application started on the shell.

2. The method according to claim 1, characterized in that, Determining whether the application is started by logging in to a shell of a third-party telnetd through the parent process of the application and the file node number of the root directory of the application includes: Judging whether the parent process of the application contains a telnetd service process; When the judgment result is yes, judging whether the file node number of the root directory of the application is different from the file node number of the system root directory; When the judgment result is yes, determining that the application is started through a shell of a third-party telnetd.

3. The method according to claim 1, wherein Before obtaining the root directory of the application, the method further includes: Reconstructing the root directory of the application for the telnetd service process, wherein the root directory of the application is a sub-directory of the system root directory, and the root directory of the application is used to store files that can be accessed by the third party.

4. A control device for remote login, characterized in that, Including: A receiving module, configured to receive an operation command sent by a client through an application; A determining module, configured to determine whether the application is started by logging in to a shell of a third-party telnetd; A processing module, configured to, when the determination result is yes, control the application started on the shell and respond to the operation command; Wherein, the processing module is further configured to perform signature verification on the application started on the shell; perform resource limitation on the application started on the shell login; perform capability setting on the application started on the shell login; Wherein, the determining module includes: An obtaining sub-module, configured to obtain the root directory of the application; A determination sub-module, configured to determine whether the application is started by logging in to a shell of a third-party telnetd according to a root directory of the application, includes: obtaining a parent process of the application and a file node number of the root directory of the application; and determining whether the application is started by logging in to a shell of a third-party telnet according to the parent process of the application and the file node number of the root directory of the application.

5. A computer-readable storage medium, characterized in that, A computer program is stored in the storage medium, wherein the computer program is configured to execute the method described in any one of claims 1 to 3 when running.

6. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method for implementing terminal service program by telnet login mode

    CN101155043A