本文介绍如何在debian系统上配置tigervnc远程桌面。
一、安装tigervnc服务器
首先,更新系统软件包:
sudo apt update sudo apt upgrade
然后,安装tigervnc服务器和必要的扩展:
sudo apt install tigervnc-standalone-server tigervnc-xorg-extension
二、设置vnc密码
运行以下命令设置vnc访问密码:
vncpasswd
系统会提示您输入并确认密码。
三、启动vnc服务器
使用以下命令启动vnc服务器,:1 表示第一个vnc会话:
vncserver :1
四、配置vnc服务器启动程序
vnc服务器的启动脚本位于~/.vnc/xstartup。编辑此文件,配置启动的桌面环境。例如,要启动gnome桌面环境,可以添加以下内容:
#!/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 & gnome-panel & metacity & nautilus & gnome-terminal & dbus-launch --exit-with-session gnome-session &
记得赋予脚本执行权限:
chmod +x ~/.vnc/xstartup
五、设置开机自启动 (可选)
要使vnc服务器随系统启动,编辑/etc/systemd/system/vncserver@:1.service文件,添加以下内容,将your_username和your_groupname替换为您的实际用户名和组名:
[unit] description=remote desktop service (vnc) after=syslog.target network.target [service] type=forking user=your_username group=your_groupname workingdirectory=/home/your_username execstartpre=/usr/bin/vncserver -kill :%i /dev/null 2>&1 execstart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i execstop=/usr/bin/vncserver -kill :%i [install] wantedby=multi-user.target
然后重新加载systemd配置并启用服务:
sudo systemctl daemon-reload sudo systemctl enable vncserver@:1.service
六、防火墙配置
允许防火墙通过5901端口 (默认vnc端口) 的连接:
sudo ufw allow 5901
七、客户端连接
使用vnc客户端(如tightvnc viewer),输入以下地址连接到远程桌面,将your_server_ip替换为您的服务器ip地址:
your_server_ip:1
连接时,需要输入之前设置的vnc密码。
以上就是debian系统中tigervnc远程桌面设置的详细内容,更多请关注代码网其它相关文章!
发表评论