文章目录
1, centos6安装vnc服务端
vnc常用命令
设置vnc随机登录密码
设置ssh 密钥文件登录:禁止密码登录
2, ubuntu安装vnc服务端
3, windows 安装vncviewer客户端
1, centos6安装vnc服务端
# 1, install vncserver
yum -y install epel-release
yum -y install vnc-server
# 2, 安装xfce桌面,安装中文输入法
# yum grouplist|grep -i xfce
yum -y groupinstall 'X Window system'
yum -y groupinstall Xfce
yum install "@Chinese Support"
#3,启动vnc: 按照提示输入远程连接密码,允许端口转发
# 端口是根据命令指定的: vncserve :1--> 5901, vncserve:10-->5910
iptables -I INPUT -p tcp --dport 5901:5902 -j ACCEPT
iptables -I INPUT -p udp --dport 5901:5902 -j ACCEPT
service iptables save
vncserver
cat > ~/.vnc/xstartup<
vnc常用命令
#1, 查看已创建的连接
[a@a ~]$ vncserver -list
TigerVNC server sessions:
X DISPLAY #PROCESS ID
:1141496
:241915
:49389
:38731
# 2, 断开连接
[a@a ~]$ vncserver -kill :3
Killing Xvnc process ID 8731
[a@a ~]$ vncserver -list
TigerVNC server sessions:
X DISPLAY #PROCESS ID
:1341496
:541915
:49389
# 3, 创建新的连接
[a@a ~]$ vncserver :6
New 'eadage:6 (yskj)' desktop is eadage:6
Starting applications specified in /home/yskj/.vnc/xstartup
Log file is /home/yskj/.vnc/eadage:6.log
[a@a ~]$ vncserver -list
TigerVNC server sessions:
X DISPLAY #PROCESS ID
:1341496
:541915
:655923
:49389
设置vnc随机登录密码
##设置vnc登录密码
vncpasswd
Password
verfiy:
# 1, hash + date
wang@controller:~$ date +%s |sha256sum |base64 |head -c 32 ;echo
MjFjOTRkOWFhNzA2YTUwZmQ1NjUyMTBk
# 2, openssl 产生随机数
wang@controller:~$ openssl rand -base64 32
V6wuudtVzYX6+/1g/Ic39E7TFxfRd7439oQ+gKCQ/E0=
# 3,系统随机数
wang@controller:~$ < /dev/urandom tr -dc .\*\?_A-Z-a-z-0-9 |head -c${1:-32};echo
?CTJ2zMn*QwVFkSlMVCcpI.kbZ5vOUjC
设置ssh 密钥文件登录:禁止密码登录
在服务器配置:(1,生成密钥; 2,配置ssh; 3, 下载私钥)
[root@host .ssh]$ chmod 600 authorized_keys
[root@host .ssh]$ chmod 700 ~/.ssh
#边界ssh配置文件: /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
PermitRootLogin yes
PasswordAuthentication no
service sshd restart
在客户机测试登录服务器:
root@controller:~# ssh -i id_rsa 192.168.1.40
Last login: Tue Jun 11 13:42:44 2019 from 192.168.1.33
[root@cent6 ~]#
2, ubuntu安装vnc服务端
#1, 更换源
cd /etc/apt
cp sources.list sources.list.back
cat >sources.list
3, windows 安装vncviewer客户端
软件下载:https://vnc-viewer.informer.com/download/#downloading
直接点击,运行: 输入要访问的ip:id号, 填写登录密码即可