Read a lot of information on the Internet, is completely chaotic.
I'm using a CentOS7.1 system. My requirement is that Windows clients have remote access to the CentOS system.
1, first need to check whether the server has a VNC service installed, check the server's installation of VNC command is as follows:
Rpm-qa | grep VNC
If installed, the version number that displays Tigervnc is displayed.
2, if no VNC is installed, you can install it using the following command:
Yum Install Tigervnc Tigervnc-server
3, edit the configuration file using the following command:
Vi/etc/sysconfig/vncservers
When using the above command, it is possible that the configuration file already exists on your server, or it may not exist on your server and add the following content to the configuration file:
Vncservers= "1:root"
vncserverargs[1]= "-geometry 800x600"
The following section is the above-mentioned configuration file annotations, for reference purposes:
#这个是配置远程桌面登录的用户名, if two users, use vncservers= "1:user1 2:user2",
And so on, by default, the 1:user1 corresponds to the 5901,2:user2 corresponding to 5902 (the default listening port for VNC is 5900 and the listener port rule is 590+usernumber), as follows
Vncservers= "Usernumber:myusername"
#下面这项配置为登录桌面配置, where the "1" is the user sequence number, 800x600 resolution ---feel that this resolution is changed and has no effect
4, use the following command to set the password for VNC (need to use SU switch to the user to set the VNC password, such as: Su user1, where User1 is in the above configuration file write account)
vncpasswd
5, after setting the password, is to start the VNC service, the start of the VNC service also need to use Su user1 (User1 is in the above configuration file written in the account) to switch to the account to start the service
Vncserver:1
6, other commands
VNCSERVER:N//Open nth Service
Vncserver-list//See there are several in the run
VNCSERVER-KILL:N//Kill the first few services
VNCPASSWD//Change Password
7. Service Management
Service Vncserver Restart ---This command also does not execute, prompting no such file or directory
Other usage:/etc/init.d/vncserver {start|stop|restart|try-restart|status|force-reload}
Chkconfig Vncserver on joined to self-booting (chkconfig--level vncserver on)
To set up the VNC service boot start with the following command:----This cannot be set, the command cannot be executed, the prompt does not have this file or directory
Chkconfig Vncserver on
In some minimal systems, even English will appear
8. Use Netstat-nat to view the listening port (default is 5901,5902,5903, etc.) after boot.
It is true that the program started, and the listening port also exists.
9, firewall settings, you need to configure rules to allow TCP packets for the corresponding ports to pass.
Reference configuration: Iptables-i input 1-p tcp--dport 5901-j ACCEPT (where-I input 1 represents the insertion of a rule, the position of this rule is 1, please refer to iptables related configuration for details)
---Firewall here do not know how to set, access, and finally use the command to shut down the firewall, the client can access the
10, Client Connection
CentOS: Connect ip:1 using Tigervnc Viewer
Windows: Connect ip:1 with real VNC viewer---I got a realvnc from the Internet, and I need license.
Enter a password to access
11,VNC client and host share Pasteboard
Target host is CentOS, terminal host is Windows (that is, using VNC on Windows to login CentOS)
Execute in Linux:
vncconfig-nowin&
After you select the text in Linux, you can paste it directly in Windows without requiring additional keystrokes. Select text in Windows, CTRL + C, press the middle key in Linux to paste
Eventually, it's still accessible.
CentOS7.1 Configuring Remote Desktop