Method and system for user interaction with ubuntu virtual machine under noVnc environment
By using the SSH service and clipboard manager in the noVnc environment, file upload and download and clipboard sharing between the Ubuntu virtual machine and the browser are realized, solving the problem that noVnc cannot realize these functions and improving the user experience.
Patent Information
- Application Number
- CN202310067620.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-17
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-01-17
AI Technical Summary
When users interact with the Ubuntu virtual machine in the noVnc environment, file upload and download and clipboard sharing cannot be achieved, and the user experience is not friendly.
Based on the SSH service, the file upload and download functions are realized through the SFTP protocol, and the clipboard manager is used to replace the clipboard that comes with the Ubuntu virtual machine. The SSH service is used to execute shell commands to modify the clipboard content, realizing file transfer and clipboard sharing between the browser and the virtual machine.
Without installing any plug-in tools, users can upload and download files and share clipboards through the browser, which improves the user experience.
Smart Images

Figure CN115951964B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer application, in particular to a method and system for user interaction with ubuntu virtual machine in noVnc environment. BACKGROUND
[0002] In the development of teaching training platform, the scene of providing independent virtual machine service for platform users will be encountered, and users can access the virtual machine on any machine that can access the Internet environment to complete learning experiment tasks. noVnc is an html5 VNC client that can exactly match our needs. However, in actual use, it is found that noVnc has obvious shortcomings, it cannot upload and download files like ssh tools, share clipboards, and the use experience is not friendly. SUMMARY
[0003] The technical task of the present application is to provide a method and system for user interaction with ubuntu virtual machine in noVnc environment to solve the above problems, which realizes the interaction between the user and the virtual machine in the noVnc environment, and the client does not need to install any plug-in tools, realizes the functions of file upload and download, and clipboard sharing.
[0004] The technical solution adopted by the present application to solve its technical problems is:
[0005] A method for user interaction with virtual machine in noVnc environment, based on ssh service, realizing file upload and download function between browser and virtual machine, and realizing clipboard function;
[0006] The file upload and download function is based on the ssh service of the ubuntu virtual machine, and the file upload and download interface is realized by means of the sftp protocol contained in ssh, and the browser can directly call the back-end interface to realize file transmission;
[0007] The clipboard function replaces the clipboard of the ubuntu virtual machine by means of the clipboard manager, and the clipboard content is modified by means of the ssh service in the form of directly executing shell commands. Through the clipboard manager, the clipboard is uniformly managed, the clipboard content can be directly modified in the form of interface, and the paste and copy function between the browser and the virtual machine is realized.
[0008] noVnc is an html5 VNC client, which is widely used in cloud computing and virtual machine control panel. Users can access and operate virtual machine system through browser without installing various plug-in tools. However, in actual use, users often need to upload and download files or copy and paste commands to virtual machine to execute, and noVnc does not support these functions. The method provides an implementation scheme of user interaction with ubuntu virtual machine in noVnc environment, realizes file upload and download and clipboard sharing function, and improves user experience.
[0009] Further, the specific implementation mode of the method is as follows:
[0010] 1), basic environment configuration,
[0011] installing ssh service in the virtual machine and setting booting;
[0012] 2), file upload and download,
[0013] realizing file transmission interface based on sftp protocol of ssh service;
[0014] 3), clipboard function implementation,
[0015] after replacing the system self-provided clipboard through the clipboard manager, realizing sharing through the clipboard manager.
[0016] Preferably, the clipboard manager includes copyQ and ditto.
[0017] Preferably, the file upload and download are realized through a class library;
[0018] the class library is Jsch package in Java.
[0019] Further, the clipboard function implementation is based on ssh service, and Jsch package is used to execute command line management of the clipboard manager;
[0020] Preferably, the clipboard sharing includes modifying and reading the clipboard content.
[0021] The application also claims to protect a system of user interaction with virtual machine in noVnc environment, which realizes file upload and download function between browser and virtual machine based on ssh service, directly accesses virtual machine system through browser, and realizes interaction.
[0022] The system realizes the method of user interaction with virtual machine in noVnc environment.
[0023] Further, the system uniformly manages the clipboard through a clipboard manager, directly modifies the clipboard content in the form of an interface, and realizes the function of copying and pasting between the browser and the virtual machine.
[0024] The application also claims to protect a device for user interaction with a virtual machine in a noVnc environment, comprising at least one memory and at least one processor.
[0025] The at least one memory is used to store machine-readable programs.
[0026] The at least one processor is used to call the machine-readable programs and execute the method for user interaction with a virtual machine in a noVnc environment.
[0027] The application also claims to protect a computer readable medium, which stores computer instructions, and the computer instructions make the processor execute the method for user interaction with a virtual machine in a noVnc environment when executed by the processor.
[0028] Compared with the prior art, the method for user interaction with a virtual machine in a noVnc environment has the following beneficial effects:
[0029] The method realizes user interaction with a virtual machine in a noVnc environment, and the client does not need to install any plug-in tools, directly accesses the virtual machine system desktop through a browser, realizes interaction between the browser and the virtual machine, realizes file uploading and downloading, clipboard sharing function, and improves user experience. BRIEF DESCRIPTION OF DRAWINGS
[0030] Figure 1 It is a method for user interaction with a virtual machine in a noVnc environment provided by the embodiment of the application. DETAILED DESCRIPTION
[0031] The application will be further described below in combination with specific embodiments.
[0032] The embodiment of the application provides a method for user interaction with a virtual machine in a noVnc environment, which is based on an ssh service, realizes file uploading and downloading function between a browser and a virtual machine, and realizes a clipboard function.
[0033] The file uploading and downloading function is based on the ssh service of an ubuntu virtual machine, realizes a file uploading and downloading interface by means of an sftp protocol contained in the ssh, and the browser can directly call a back-end interface to realize file intercommunication.
[0034] The clipboard function replaces the clipboard of the ubuntu virtual machine by a clipboard manager, modifies the clipboard content by a shell command through the ssh service, and directly modifies the clipboard content through the clipboard manager in the form of an interface to realize the paste and copy function between the browser and the virtual machine.
[0035] The method realizes the interaction between the browser and the virtual machine without installing any plug-in tools, and directly accesses the virtual machine system through the browser.
[0036] The specific implementation of the method is as follows:
[0037] 1) Basic environment configuration,
[0038] File interaction and clipboard sharing are based on the ssh service, so the ssh service needs to be installed in the virtual machine and set to start at boot.
[0039] The ubuntu self-contained clipboard cannot be shared in different connection requests, so a clipboard manager needs to replace the self-contained clipboard. There are many mature tools on the market, such as copyQ and ditto.
[0040] 2) File upload and download,
[0041] The sftp protocol based on the ssh service realizes the file transfer interface. The function can be realized by using mature class libraries, such as the Jsch package in java.
[0042] 3) Realization of the clipboard function,
[0043] After replacing the system self-contained clipboard with the clipboard manager, the clipboard manager is used to realize the sharing.
[0044] Based on the ssh service, the channel under the Jsch package is used to execute the command line to manage the clipboard manager. The clipboard content is modified and read to achieve the effect of clipboard sharing.
[0045] The file upload and download function of the method is based on the ssh service of the ubuntu virtual machine, and the sftp protocol contained in the ssh is used to realize the file upload and download interface. The browser can directly call the back-end interface to realize the file transmission;
[0046] The clipboard function, the ubuntu system is provided with a clipboard, the content of the clipboard can be modified through the shell command executed directly by the ssh service, but the noVnc connection and the ssh connection are two different connections, and the clipboard is not shared between different connections, therefore, a clipboard manager is needed to replace the clipboard function of the system, and then the clipboard manager is modified in the mode of the ssh, so that the clipboard sharing function is realized.
[0047] The embodiment of the application further provides a system for user interaction with a virtual machine in a noVnc environment, based on an ssh service, realizing file uploading and downloading between a browser and a virtual machine, directly accessing the virtual machine system through the browser, and realizing interaction.
[0048] The system realizes the method for user interaction with a virtual machine in a noVnc environment as described above.
[0049] 1), basic environment configuration,
[0050] The ssh service is installed in the virtual machine, and the start-up is set.
[0051] The ubuntu system is provided with a clipboard, the content of the clipboard can be modified through the shell command executed directly by the ssh service, but the noVnc connection and the ssh connection are two different connections, and the clipboard is not shared between different connections, therefore, a clipboard manager is needed to replace the clipboard function of the system, and then the clipboard manager is modified in the mode of the ssh, so that the clipboard sharing function is realized.
[0052] 2), file uploading and downloading,
[0053] The sftp protocol based on the ssh service is used to realize the file transmission interface, and a mature class library can be used to realize the function, such as the Jsch package in java.
[0054] 3), realization of the clipboard function,
[0055] After the clipboard manager replaces the clipboard provided by the system, the clipboard manager is used to realize sharing.
[0056] Based on the ssh service, the channel in the Jsch package is used to execute the command line to manage the clipboard manager, and the content of the clipboard is modified and read, so that the clipboard sharing effect is achieved.
[0057] The system uses the clipboard manager to uniformly manage the clipboard, directly modifies the content of the clipboard in the form of an interface, and realizes the function of pasting and copying between the browser and the virtual machine.
[0058] The embodiment of the application further provides a device for user interaction with a virtual machine in a noVnc environment, comprising at least one memory and at least one processor.
[0059] The at least one memory is used to store a machine-readable program.
[0060] The at least one processor is configured to invoke the machine-readable program to execute the method for user interaction with the virtual machine in the noVnc environment as described in the above embodiments.
[0061] The embodiment of the present application also provides a computer readable medium, wherein computer instructions are stored on the computer readable medium, and the computer instructions, when executed by a processor, cause the processor to execute the method for user interaction with the virtual machine in the noVnc environment as described in the above embodiments. Specifically, a system or device equipped with a storage medium can be provided, wherein software program codes realizing the functions of any one of the above embodiments are stored on the storage medium, and the computer (or CPU or MPU) of the system or device reads out and executes the program codes stored in the storage medium.
[0062] In this case, the program codes read from the storage medium can realize the functions of any one of the above embodiments by themselves, and thus the program codes and the storage medium storing the program codes constitute a part of the present application.
[0063] Embodiments of the storage medium for providing the program codes include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program codes can be downloaded from a server computer via a communication network.
[0064] In addition, it should be clear that not only the program codes read by the computer can be executed, but also part or all of the actual operations can be performed by an operating system or the like operating on the computer based on the instructions of the program codes, thereby realizing the functions of any one of the above embodiments.
[0065] In addition, it should be understood that the program codes read from the storage medium can be written into a memory provided in an expansion board inserted into the computer or a memory provided in an expansion unit connected to the computer, and then part or all of the actual operations can be performed by a CPU or the like installed on the expansion board or the expansion unit based on the instructions of the program codes, thereby realizing the functions of any one of the above embodiments.
[0066] The present application has been described in detail by the above drawings and preferred embodiments, however, the present application is not limited to these disclosed embodiments, and those skilled in the art can know that more embodiments of the present application can be obtained by combining the code auditing means in the above different embodiments, and these embodiments are also within the protection scope of the present application.
Claims
1. A method for user-virtual machine interaction in a noVnc environment, characterized in that: Based on SSH service, realize the file upload and download function between browser and virtual machine, and realize the clipboard function; The file upload and download function is based on the SSH service of the Ubuntu virtual machine, and uses the SFTP protocol contained in SSH to implement the file upload and download interface. The browser can directly call the backend interface to realize file transfer; The clipboard function replaces the clipboard of the Ubuntu virtual machine with a clipboard manager, and modifies the clipboard content by directly executing shell commands through the SSH service; The specific implementation of this method is as follows: 1) Basic environment configuration, Install the ssh service in the virtual machine and set it to start at boot; 2) File upload and download, Based on the sftp protocol of ssh service, the file transfer interface is realized; 3) Clipboard function implementation, After replacing the system's own clipboard with the clipboard manager, share it through the clipboard manager; The clipboard manager includes copyQ and ditto; The clipboard function is implemented based on the ssh service, using the channel under the Jsch package to execute the command line to manage the clipboard manager.
2. The method for user-virtual machine interaction in a noVnc environment according to claim 1, characterized in that: The file upload and download are realized through the class library; The class library is the Jsch package in Java.
3. The method for user-virtual machine interaction in a noVnc environment according to claim 1, characterized in that: Clipboard sharing includes modifying and reading clipboard contents.
4. A system for user-virtual machine interaction in a noVnc environment, characterized in that: Based on SSH service, the file upload and download function between the browser and the virtual machine is realized, and the virtual machine system is directly accessed through the browser to achieve interaction; The system implements the method for user-virtual machine interaction in the noVnc environment as described in any one of claims 1 to 3.
5. A system for user-virtual machine interaction in a noVnc environment according to claim 4, characterized in that: The system manages the clipboard uniformly through the clipboard manager, directly modifies the clipboard content in the form of an interface, and realizes the paste and copy functions between the browser and the virtual machine.
6. A device for user-virtual machine interaction in a noVnc environment, characterized in that include: at least one memory and at least one processor; The at least one memory is configured to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method for user-virtual machine interaction in the noVnc environment according to any one of claims 1 to 3.
7. A computer-readable medium, characterized in that The computer-readable medium stores computer instructions, which, when executed by a processor, enable the processor to execute the method for user-virtual machine interaction in the noVnc environment according to any one of claims 1 to 3.
Citation Information
Patent Citations
Character input method of display equipment, input equipment and system
CN105808053A
Method and device for implementing console based on novnc for XenServer
CN107634892A
Method and device for transmitting files to VMWare virtual machine, equipment and medium
CN111371885A