On Linux, enable the graphical interface of VNC Remote Management Service (to solve the gray image problem)

Source: Internet
Author: User
Tags windows remote desktop

On Linux, enable the graphical interface of VNC Remote Management Service (to solve the gray image problem)

The VNC configuration in Linux is described in detail. The following configuration is a detailed introduction to VNC configuration. And solved the problem that the screen was gray when the VNC View was used for login.

1. VNC configuration in Linux

First, after installing the VNC-server Service under system tools in add/remove applications in Linux, directly enter vncserver to display the following content:

Passwd: // only when this account is running vncserver For The First Time requires you to enter the connection password.

Verify:

New 'server1. linux: 4 (demo) 'desktop is server1.linux: 1

Starting applications specified in/home/. vnc/xstartup

Log file is/home/. vnc/server1.linux: 1.log

The above section indicates that a graphical terminal is started and the number is 1. Remember this number and provide it when you log on. To start VNC for the first time, you must enter vncserver directly. If you want to stop the process, use the command

Vncserver-kill: 1

After the client is started, you can enter the IP address and the number you just mentioned on the client to log on to the machine (xxx. xxx: 1) and see a gray Xwindow desktop.

After running VNSERVER once, a file is generated under the HOME directory. VNC folder (you can see the location of this folder when starting) Note: This directory is hidden and you can enter the path directly. Modify the xstartup file, remove the annotator before unset SESSION_MANAGER and exec/etc/X11/xinit/xinitrc, and change the last line of twm & to gnome-session &

Vi/root/. vnc/xstartup

#! /Bin/sh

# Uncomment the following two lines for normal desktop:
# Unset SESSION_MANAGER // remove this line comment
# Exec/etc/X11/xinit/xinitrc // remove this line of comment

[-X/etc/vnc/xstartup] & exec/etc/vnc/xstartup
[-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Twm & // change to gnome-session &

Restart VNCSERVER.

2. start, stop, and restart VNC

# Service vncserver start/stop/restart

Run the following command to disable vncserver:

Vncserver-kill: 1

Vncserver-kill: 2

3. Set the password

# Vncpasswd

4. Client Login

In the vnc client, enter: Server IP: 1 or server IP: 2.

5. log on to the KDE Desktop

Note: in many cases, you are prompted that the VNC cannot be connected, or that the 10086 error is because the vncservers file is not modified.

# VNCSERVERS = "1: myusername"

# VNCSERVERARGS [1] = "-geometry 800x600"

These two problems can be solved in general.

A.

[Root @ CentOS ~] # Vi/etc/sysconfig/vncservers

# Uncomment the line below to start a VNC server on display: 1 # as my 'myusername' (adjust this to your own ). you will also # need to set a VNC password; run 'man vncpasswd' to see how # to do that. # do not run this service if your local area network is # untrusted! For a secure way of using VNC, see # <URL:>. http://www.uk.research.att.com/vnc/sshvnc.html

# VNCSERVERS = "1: myusername"

VNCSERVERS = "1: root"

# VNCSERVERARGS [1] = "-geometry 800x600"

VNCSERVERARGS [1] = "-geometry 800 × 600-alwaysshared-depth 24 ″

-Alwaysshared indicates that multiple users are allowed to log on at the same time. The value of depth is 8, 16, 24, and 32.

Note: The red part is the modified or added part.

B.

[Root @ centos. vnc] $ vi/root/. vnc/xstartup #! /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 & xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop" & # gnome-session & # set starting GNOME desktop startkde & # kde desktop

# Twm &

# Text interface

Note: The red part is the modified or added part.

C.

Restart VNC.

Install Oracle in vnc:

Error message: "Xlib: connection to": 1.0 "refused by server"

Handle the following:

Practical Tips: Procedure for setting xhost in Linux

Source: http://www.knowsky.com/397544.html

Step 1: Use root to log on to linux and start the vnc service;

Step 2: Set export DISPLAY = localhost: 1 (1 indicates that vnc is started on the first tty) based on the port of the vnc. For more information about starting vnc, see Attachment 1;

Step 3: Execute xhost + and prompt "access control disabled, clients can connect from any host.

The operation logs in Linux are as follows:

[Root @ localhost ~] # VncserverNew 'localhost: 1 (root) 'desktop is localhost: 1 Starting applications specified in/root /. vnc/xstartupLog file is/root /. vnc/localhost: 1.log[ root @ localhost ~] # Export DISPLAY = localhost: 1 [root @ localhost ~] # Xhost + access control disabled, clients can connect from any host

When xhost is set, the problem of unable occurs.

The appeal method can be used.

The configuration file for my Login as root

[Root @ PC-223-CE ~] # Vi/etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display: user pairs.
#
# Uncomment the lines below to start a VNC server on display: 2
# As my 'myusername' (adjust this to your own). You will also
# Need to set a VNC password; run 'man vncpasswd' to see how
# To do that.
#
# Do not run this service if your local area network is
# Untrusted! For a secure way of using VNC, see
# <URL: http://www.uk.research.att.com/vnc/sshvnc.html>.

# VNCSERVERS = "2: myusername"
# VNCSERVERARGS [2] = "-geometry 800x600"
VNCSERVERS = "1: root"
VNCSERVERARGS [1] = "-geometry 800x600-alwaysshared-depth 24"
~

[Root @ PC-223-CE ~] # Vi/root/. vnc/xstartup
#! /Bin/sh

# Uncomment the following two lines for normal desktop:
# Unset SESSION_MANAGER
# Exec/etc/X11/xinit/xinitrc
Xrdb $ HOME/. Xresources
# [-X/etc/vnc/xstartup] & exec/etc/vnc/xstartup
# [-R $ HOME/. Xresources] & xrdb $ HOME/. Xresources
Xsetroot-solid gray
# Vncconfig-iconic &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
# Twm &
Gnome-session &
~

Save the changes and restart VNC.

3. logon from multiple users

Linux VNC can be connected to multiple users at the same time. The method is as follows:

Su User Name

Vncserver (this is the second user)

The third user is

Su User Name

Vncserver

After adding the user, add the user to/etc/sysconfig/vncserver. Otherwise, the user will be grayed out after logon.

You also need to modify the. vnc/xstartup file in the user directory.

For example, I already have a root user on my computer. At this time, I still need ocmSUSEr to log on to VNC.

[Root @ bkjia ~] # Su ocmsuser
[Ocmsuser @ bkjiaroot] $ vncserver

You will require a password to access your tops.

Password:
Verify:

New 'ywei: 2 (ocmsuser) 'desktop is ywei: 2

Creating default startup script/home/ocmsuser/. vnc/xstartup
Starting applications specified in/home/ocmsuser/. vnc/xstartup
Log file is/home/ocmsuser/. vnc/ywei: 2.log

[Ocmsuser @ bkjiaroot] $ su-root
Password:

[Root @ bkjia ~] # Vi/etc/sysconfig/vncservers

The VNCSERVERS variable is a list of display: user pairs.
#
# Uncomment the lines below to start a VNC server on display: 2
# As my 'myusername' (adjust this to your own). You will also
# Need to set a VNC password; run 'man vncpasswd' to see how
# To do that.
#
# Do not run this service if your local area network is
# Untrusted! For a secure way of using VNC, see
# <URL: http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting tables t when
# Doing so through a secure tunnel. See the "-via" option in
# 'Man vncviewer 'manual page.

VNCSERVERS = "1: root"
VNCSERVERARGS [1] = "-geometry 1280x800-alwaysshared-depth 24"
VNCSERVERS = "2: ocmsuser"
VNCSERVERARGS [2] = "-geometry 1280x800-alwaysshared-depth 24"
~

[Root @ bkjia ~] # Cat/root/. vnc/xstartup
#! /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 &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Twm &
[Root @ bkjia ~] # Cat/home/ocmsuser/. vnc/xstartup
#! /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 &
Xterm-geometry 80x24 + 10 + 10-ls-title "$ VNCDESKTOP Desktop "&
Twm &
[Root @ bkjia ~] # Cp/home/ocmsuser/. vnc/xstartup/home/ocmsuser/. vnc/xstartup. bak
[Root @ bkjia ~] # Cp/root/. vnc/xstartup/home/ocmsuser/. vnc/xstartup
Cp: overwrite '/home/ocmsuser/. vnc/xstartup '? Yes
[Root @ bkjia ~] # Service vncserver restart
Shutting down VNC server: 2: ocmsuser [OK]
Starting VNC server: 2: ocmsuser
New 'ywei: 2 (ocmsuser) 'desktop is ywei: 2

Starting applications specified in/home/ocmsuser/. vnc/xstartup
Log file is/home/ocmsuser/. vnc/ywei: 2.log

[OK]
[Root @ bkjia ~] #

Install VNC Server in CentOS 6.5 for graphical access

VNC installation Configuration

Install and configure VNC in CentOS 6.3

In Linux, the dependency installation VNC is not detected.

CentOS6 VNC service installation and configuration

Configure and install VNC in CentOS

VNC remote control installation and Setup

Windows accesses Ubuntu through VNC

Install VNC for accessing Ubuntu 12.04 through Windows Remote Desktop

This article permanently updates the link address:

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.