Ubuntu 20.04 远程桌面-vnc配置

1、安装 VNC server

qiuji:~$ sudo apt-get -y install tigervnc-standalone-server

2、为 VNC server 设置密码

qiuji:~$ vncpasswd

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

3、启动 VNC server 服务

qiuji:~$ vncserver :1
ubuntu@dlp:~$ vncserver :1
/usr/bin/xauth:  file /home/ubuntu/.Xauthority does not exist

New 'dlp.srv.world:1 (ubuntu)' desktop at :1 on machine dlp.srv.world

Starting applications specified in /etc/X11/Xvnc-session
Log file is /home/ubuntu/.vnc/dlp.srv.world:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/ubuntu/.vnc/passwd :1 to connect to the VNC server.

4、停止 VNC server 服务

qiuji:~$ vncserver -kill :1
Killing Xtigervnc process ID 4123... success!

5、配置 VNC server 服务

qiuji:~$ ossifrage@ousikongjian:~$ vi ~/.vnc/xstartup
显示如下内容:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

6、重新启动 VNC server 服务

qiuji:~$ vncserver :1 -geometry 1920x1080 -localhost no

注意事项需要在普通权限下启动 vnc 否者远程不能使用普通用户权限

posted @ 2021-10-17 23:19  秋吉  阅读(1964)  评论(0编辑  收藏  举报