How to Use Xmanager and VNC to log on to the Remote Desktop and xmanagervnc to log on

Source: Internet
Author: User

How to Use Xmanager and VNC to log on to the Remote Desktop and xmanagervnc to log on

There are two common methods to call Remote Desktop: Xmanager and VNC.

Just today, I had a click, and it was sorted as follows:

Xmanager

Xmanager can be called in either of the following ways:

1. Directly calling in Xshell

In this case, you need to set the session properties, as shown in. You need to check "Forward X11 connection (X):" on the "Tunnel" option ):"

2. Use Xstart to log on to the Remote Desktop

The host, user name, and identity authentication are required, and the protocol must be SSH. The key is to enter the command (Detailed Table below). After Entering the protocol, you can click "run"

The following commands are used to log on to the Remote Desktop:

1> gnome-session calls gnome Desktop

2> startkde calls kde Desktop

3>/usr/bin/xterm-ls-display $ DISPLAY call terminal window

The first and second types are easier to understand. The third type of image is actually a terminal window.

Note: These three commands are also applicable in Xshell. In fact, the effect of the Third Command is a terminal window similar to Xshell.

If the error "/usr/bin/xterm: DISPLAY is not set" is reported, you can set xhost + or export DISPLAY = 192.168.2.1: 0.0 on the terminal. Here, 192.168.2.1 refers to the client address.

In the actual production environment, it is often unnecessary to log on to the Remote Desktop and directly call the application. For example, to install Oracle, run./runInstaller directly.

 

VNC

VNC consists of vncserver and vncviewer. vncserver is a server software that provides VNC services. vncviewer is a client software that remotely calls VNC services. To put it bluntly, vncviewer can remotely log on to the host where the vncserver is located.

Here, we use the tigervnc-server that comes with Redhat as the server software.

1. Install the server software

# yum install tigervnc-server -y

2. Set the vncserver Password

# vncserver

The first execution requires you to enter a password of at least six digits, which will be used later in connecting vncviewer to the server host.

Note: You can use the vncpasswd command to change the password later.

3. Start the vncserver service

There are two ways to start the vncserver service.

First:/etc/init. d/vncserver start. In this way, you need to edit the configuration file.

[root@node1 ~]# /etc/init.d/vncserver startStarting VNC server: no displays configured                [FAILED]

The preceding error is reported. You need to modify the configuration file.

$ vim /etc/sysconfig/vncservers 

Add the following content:

VNCSERVERS="1:root"

When the service is started, a VNC service is configured under the root user, and the corresponding port is 1. To enable multiple services, you can set VNCSERVERS = "1: root 2: root 3: oracle" to enable three VNC services, two of them are under the root account, with ports 1 and 2 respectively, and the other being under the oracle user, with ports 3.

PS: many blogs on the Internet will add the following content to the above configuration file: VNCSERVERARGS [1] = "-geometry 1024x768". When setting the resolution of the window, I tried it myself, no effect. The resolution of the Remote Desktop must be set on the server. :

After modifying the configuration file, start again

[root@node1 ~]# /etc/init.d/vncserver startStarting VNC server: 1:root New 'node1.being.com:1 (root)' desktop is node1.being.com:1Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/node1.being.com:1.log                                                           [  OK  ]

The above output shows that the newly generated desktop address is node1.being.com: 1, and node1.being.com is the local host name.

Next, let's look at the window corresponding to the newly generated desktop.

[root@node1 ~]# netstat -ntlup |grep vnctcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      9164/Xvnc           tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      9164/Xvnc           tcp        0      0 :::6001                     :::*                        LISTEN      9164/Xvnc 

In fact, 5901 is the default first port of the vncserver service, corresponding to 1 in node1.being.com: 1.

Second, directly run the # vncserver command to enable the vncserver service, as shown below:

[root@node1 ~]# vncserverNew 'node1.being.com:2 (root)' desktop is node1.being.com:2Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/node1.being.com:2.log

This method is usually easier and does not require the/etc/sysconfig/vncservers file to be configured.

You can select the appropriate option based on the actual use scenario. The first option is suitable for VNC with frequent requirements. You can set to enable auto-start, but the operation is slightly troublesome. You need to modify the configuration file, multiple services can be enabled at the same time. The second type is suitable for the occasional VNC needs. The operation is convenient and simple, and only one service can be enabled at a time.

In this case, we can use vncviewer to log on

4. Remote logon using vncviewer

Click Connect"

Enter the password set in step 2 and click "OK" to log on. Note: The Username is gray and cannot be filled in. In this example, because the vncserver service is enabled under the root account, the root account is logged in by default.

5. Disable the vncserver service

There are two ways to disable the vncserver service,

# /etc/init.d/vncserver stop

This method is based on/etc/sysconfig/vncservers. If VNCSERVERS = "1: root 2: root 3: oracle ", the three services will be closed at the same time. The output content is as follows. The vncserver service enabled by manually executing the # vncserver command is not disabled.

[root@node1 ~]# /etc/init.d/vncserver stopShutting down VNC server: 1:root 2:root 3:oracle           [  OK  ]

The second method is to manually close the specified port. The syntax is as follows:

$ vncserver -kill :1

6. Set auto-start upon startup

# chkconfig vncserver on

Summary:

This configuration is based on RHEL 6.3. $ user_home/is not required for 6x versions /. vnc/xstartup, where $ user_home is the home directory of the user who executes the vncserver command. If it is executed by the root user, $ user_home indicates/root. If it is executed by the oracle user, it is/home/oracle, and so on. The 6x version will start the Server login window by default, which is generally gnome. If it is a 5x version system, the window may be relatively simple, and the twm window will be displayed, $ user_home /. vnc/xstartup file.

Take root user as an Example

vim /root/.vnc/xstartup

Note twm &

Add gnome-session &

 

 

 

 

Related Article

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.