sh 从命令行启用远程VNC

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 从命令行启用远程VNC相关的知识,希望对你有一定的参考价值。

#!/bin/bash
echo $DISPLAY

export DISPLAY=:0
apt-get install -y gconftool
read -e -p "VNC Password: " -i "ubuntu" password
dconf write /org/gnome/desktop/remote-access/enabled true		# So, first, enable vino
dconf write /org/gnome/desktop/remote-access/prompt-enabled false
dconf write /org/gnome/desktop/remote-access/authentication-methods "['vnc']"
dconf write /org/gnome/desktop/remote-access/require-encryption false
dconf write /org/gnome/desktop/remote-access/vnc-password \"\'$(echo -n $password | base64)\'\"
dconf dump /org/gnome/desktop/remote-access/
sudo service gdm3 restart

# Optionally you may want to do this if you want to keep the display up all the time:

dconf write /org/gnome/desktop/screensaver/lock-enabled false
dconf write /org/gnome/desktop/screensaver/ubuntu-lock-on-suspend false
dconf write /org/gnome/desktop/session/idle-delay "uint32 0"

# This doesn't seem to work remotely via ssh due to errors about the display, you can start the server remotely using the DISPLAY flag

export DISPLAY=:0 && /usr/lib/vino/vino-server

# Check to see if the server is now running

ps aux | grep X

# https://askubuntu.com/questions/4474/enable-remote-vnc-from-the-commandline

以上是关于sh 从命令行启用远程VNC的主要内容,如果未能解决你的问题,请参考以下文章

VNC远程登陆树莓派3(包括开机启动)

树莓派使用VNC远程连接

vnc连接到服务器后,为啥只显示一个命令行

Linux 环境下安装配置 TigerVNC Server 并启用当前会话远程服务(X0VNC)

sh 通过vnc远程访问linux

怎么用VNC远程控制树莓派