How to configure vnc under linux

  
 

Summary, only four steps: step1 Run the command vncserver in the current linux system user user1 (users who need remote control in the future), follow the prompts, and generate .vnc hidden files in the user's home directory. Folder, then enter the folder, edit the xstartup file, remove the ## in front of the following two lines: # unset SESSION_MANAGER# exec /etc/X11/xinit/xinitrc These two lines indicate that the default graphics manager is started, if there is no file available Manually add; or (and) change the "twm &" in the bottom line of the xstartup file to: gnome-session # corresponds to the GNOME desktop environment or startkde # corresponds to the KDE desktop environment save exit. Step2 Switch to root user mode, edit the /etc/sysconfig/vncservers file, add two lines of parameters: VNCSERVERS="1:user1" #If you want to add multiple users, the quotes can be written like this: "1:user1 2: User2 ..."The number in front of the colon represents the remote desktop serial number ARGS="-geometry 800x600 -alwaysshared"Save and exit. Step3 Edit /etc/init.d/vncserver, and

"su - ${display##*:} -c "cd && [ -f .vnc/passwd ]&& ; vncserver :${display%%:*}""Change to: "su - ${display##*:} -c "cd && [ -f .vnc/passwd ]&& ; vncserver ${ARGS} :${display%%:*}""

The above ARGS parameters will take effect. Save and exit. Step4 Confirm that the vncserver service has been set to start with the system (check the services list), restart the system and connect with vncviewer on another host, input “IP:1”, click OK to see the user1 user desktop of the Linux host. The following are two articles reprinted. ——How to make the server boot automatically run vncserver article Source: http://blog.toohi.com/toohi/articles/456.html

VNCServer configuration redhat generally installs vncserver as long as it is in service Start it by selecting Start in the list. Start your favorite window manager by editing the file $HOME/.vnc/xstartup. Use startkde & to start KDE, gnome-session & to start GNOME. When you first create ~/.vnc/xstartup, the specified window manager is twm, which is a tiny window manager, almost every X There are twm on the Window system machine. Twm does not have most of the fancy features of the "desktop manager" (like KDE, GNOME or WindowMaker). Here is a modified example:

#!/bin/sh

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $ HOME/.Xresources ]&& xrdb $HOME/.Xresourcesxsetroot - solid greyvncconfig - iconic &#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &#twm &#exec wmaker #exec startkde gnome-session &

In the above example, the default startup of the default twm and xterm is commented out. This desktop is configured to avoid color gradients on the background and title bar, with minimal animation effects. Close the vncserver on the server to connect to vncserver -kill: the desktop number automatically runs vncserver1. Set the vncserver startup script (/etc/init.d/vncserver) to start the system from the startup vncserver.2. Edit /etc/sysconfig/vncserversVNCSERVERS= "1:user1"ARGS="-geometry 800x600 -alwaysshared "Modify "800x600" in ARGS to adapt to your X desktop actual parameter configuration. Any other VNC server parameter configuration can be added here. Modify user1 in VNCSERVERS for the user you want to run the VNC desktop. A 1 in VNCSERVERS means that VNC runs on desktop 1. If you want to add another desktop, you can modify the configuration as follows: VNCSERVERS="1:user1 2:user2 3:user3"3.Set the access password vncpasswd of vnc server on RedHat system Use the following command to start VNC: /etc/init.d/vncserver start——vnc configuration under Linux. Source: http://ailixing.blog.51cto.com/188828/38996
1, VNC startup /stop/restart#service vncserver start/stop/restart Close the specific vncserver command: vncserver -kill :1 vncserver -kill :2 2. Set the password #vncpasswd 3. Client login Enter the vnc client: Server IP: 1 or server IP: 2 4. Set to log in to the KDE desktop 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 means that multiple users can be simultaneously logged in -depth is color depth, parameters are 8, 16, 24, 32. Note: The red part is the part that was modified or added b.[root@centos .vnc]$ vi /root/.vnc/xstartup #!/bin/sh# Uncomment the following two lines for normal desktop:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &#gnome-session & #set starting GNOME desktopstartkde & #kde desktop#twm & #Text interfaceNote: The red part is The modified or added part c. Restart VNC.

Copyright © Windows knowledge All Rights Reserved