ubuntu20使用tigervnc远程桌面配置记录
一、安装tigervnc
sudo apt install tigervnc-common
sudo apt install tigervnc-standalone-server
二、增加配置文件
安装完后新增配置文件:vim ~/.vnc/xstartup
#!/bin/sh
#Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
#gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
三、设置密码
命令vncpasswd设置密码
walle@WALLE:~$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n //这里选择n
四、启动
walle@WALLE:~$ vncserver -localhost no -geometry 1920x1080 :1
Cleaning stale pidfile '/home/walle/.vnc/WALLE:1.pid'!
You will require a password to access your desktops.
New 'WALLE:1 (walle)' desktop at :1 on machine WALLE
Starting applications specified in /home/walle/.vnc/xstartup
Log file is /home/walle/.vnc/WALLE:1.log
Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/walle/.vnc/passwd WALLE:1 to connect to the VNC server.
-localhost no 需要加上才能支持远程访问
-geometry 设置远程分辨率
:1 远程绘话号
vncserver -list 可以列出当前的会话列表
vncserver -kill id 可以关掉对应的远程会话
笔记本屏幕一直打开亮着,可以进行以下配置:
sudo vi /etc/systemd/logind.conf
HandleLidSwitch=ignore
五、连接
window可以使用MobaXterm软件连接