VNC allows multiple users to share Ubuntu servers

Source: Internet
Author: User

Due to the needs of the project, I purchased a supercomputer, that is, eight-core CPU and 8 GB memory. Some time ago, due to the shortage of the project, only many people could share the same window of the Ubuntu server, that is to say, one person uses VNC to operate the server, and the other person can see his operations. When one person operates, the other person cannot operate the interface. Now he has taken the time to solve this problem, different users can operate different interfaces on the server, just like on their own PCs.

1. Install the vnc4server software.

Execute apt-Get install vnc4server in ubuntu10.10 to install it. On Windows, the client uses

Vncviewer.exe is easy to download online.

After vnc4server is installed, You need to modify the configuration file. Otherwise, the graphical interface cannot be seen after the VNC client logs on.

I use the root super user to log on to the Ubuntu system and modify the/root/. VNC/xstartup file.

Note:

By default, the/root directory is not hidden. VNC. In this case, run the vnc4server: 1 command in the terminal window. the VNC/Startup File is formed. there are two solutions to modify the/root/and VNC/xstartup files. Based on the flexible selection of the Ubuntu system you have installed, it is recommended that solution 1 be applied first. If solution 2 cannot be modified. I have used solution 1 in a 64-bit ubuntu12.04 on an X86 PC, and solution 2 is used on another 64-bit ubuntu12.04.2 system on an X86 PC. Solution 2 is used because "cocould" appears in the client window after you log on to the VNC server at the moment.
Not acquire name on session bus "prompt, and the graphic interface cannot be displayed. solution 2 will solve this problem.

Solution 1:

#! /Bin/sh

# Uncomment the following two lines for normal desktop:
# Unset session_manager
# Exec/etc/X11/xinit/xinitrc

[-X/etc/VNC/xstartup] & exec/etc/VNC/xstartup
[-R $ home/. Xresources] & xrdb $ home/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
X-terminal-emulator-geometry 80x24 + 10 + 10-ls-title "$ vncdesktop desktop "&
X-window-manager &

Append a line to the end of this file:

Gnome-session & 

Solution 2:

Run the following command before modifying the file:Chmod 755/etc/X11/xinit/xinitrc
Command

#! /Bin/sh
# Uncomment the following two lines for normal desktop:
Unset session_manager
# [-X/etc/VNC/xstartup] & exec/etc/VNC/xstartup
# [-R $ home/. Xresources] & xrdb $ home/. Xresources

Xsetroot-solid gray
# Vncconfig-iconic &
X-terminal-emulator-geometry 80x24 + 10 + 10-ls-title "$ vncdesktop desktop "&
Exec/etc/X11/xinit/xinitrc
# X-window-manager &
# Gnome-session &

There is a big gap between solution 1 and solution 2. You should pay attention to the changes.

2

After the modification, restart the computer and run vnc4server: 1 to start the VNC service. Then the VNC client can connect to the service:

New 'Monkey-MS-7678: 4 (Root) 'desktop is monkey-MS-7678: 1

Starting applications specified in/root/. VNC/xstartup
Log File is/root/. VNC/monkey-MS-7678: 1.log

 

Note: The number 1 appears here, which must be entered in the client VNC software. If your server IP address is 192.168.0.2, enter 192.168.0.2: 1 in the input window of the client, enter the password to log on.

 

If another user wants to use this server, run vnc4server again. A number 2 is generated, and the user needs to log on to the server at 192.168.0.2: 2, at this time, the operations of the two users are independent from each other, thus implementing the function of operating the same server by multiple users.


NOTE: If solution 1 and solution 2 are used, the VNC client still cannot display images normally. You can start the server to enter the command line mode,/root /. the VNC/xstartup file adopts the configuration in solution 2, so that the VNC client can see a normal graphical System (this method is feasible for the author to test ubuntu12.04.2 and log on to the command line mode as the root user ).


3

After the login is successful, if you enter D in the terminal window, the interface will be minimized to the status bar, which leads to a lot of commands with D characters cannot be executed, causing a lot of trouble for our operations, the solution is to remove the D shortcut. the method is as follows:

I am using ubuntu10.10, go to system-> preferences-> keyboardshortcuts, find the D accounting key, press the backspace key, and disable it, for example:

 

After the settings are complete, restart and enter the 'D' character'

4

As a server, we want the system to start up and run vnc4server, so that we can log on directly to the Windows client and add it to the/etc/profile file.

Vnc4server command. If you want to log on to three users without affecting each other, you need to start three vnc4servers, save the profile file, exit, and restart, of course, we need to assign a number to each person. Here we start three vnc4server, and there will be three numbers: 1, 2, and 3. Each of them uses one.

For example, a: 192.168.0.2: 1

B: 192.168.0.2: 2

C: 192.168.0.2.3

Each person remembers the number assigned to him and denies that if he or she conflicts with others, he or she will turn off the interface of the person he or she previously logged in, that is, he or she snatched it.

Appendix:

I use vnc4serverto start the vncservice. After logging in with vncviewer.exe, I start the android simulator and find that the background color of the simulator is distorted and runs on Ubuntu.

In the x11vncserver VNC service, the background color of the android simulator is displayed normally. Therefore, you can choose vnc4server or x11vncserver based on your needs. (One feature of this service is that you need to manually operate the server and run the software after the server is started, manually set parameters), select x11vncserver for only one user to operate, others to watch, of course, you can also start vnc4server and x11vncserver at the same time, so that you can log on to x11vncserver, other users can log on to vnc4server to meet the needs of each user.

 

This is a summary of how to build a VNC server to implement remote desktop operations. I hope it will help programmers who have the same requirements.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.