Aqui estão alguns scripts que eu uso para instalar o vino em controles remotos.
Dentro de um script de configuração principal, incluirei apenas o código que chama o script vnc_access (que está em um subdiretório 'vnc', mas mude para onde você colocar o segundo script.
if [ ! -z "$install_vnc" ] ; then
user_password='password'
vnc_password='password'
vnc_script="${BASH_SOURCE%/*}/vnc/vnc_access.sh"
printf '\n\tSetting up vino-server on host...\n' >&2
ssh $host_user_name@$host_address \
"bash -s" < "$vnc_script" $user_password "'$vnc_password'"
printf '\n\tDone sending vnc to host.\n' >&2
fi
E aqui está o script vnc_access.sh
#!/bin/bash
#
# Tools to enable and configure vino for vnc access
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# parse arguments
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
user_password=$1
vino_password=$2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# initialize values
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vino_password_binary="$(echo -n ${vino_password} | base64)"
declare -A settings
settings[alternative-port]="uint16 5900"
settings[authentication-methods]="['vnc']"
settings[disable-background]=false
settings[disable-xdamage]=false
settings[enabled]=true
# enum 'never' 'always' 'client'
settings[icon-visibility]="'client'"
settings[lock-screen-on-disconnect]=false
settings[mailto]="''"
settings[network-interface]="''"
settings[notify-on-connect]=true
settings[prompt-enabled]=false
settings[require-encryption]=false
settings[use-alternative-port]=false
settings[use-upnp]=false
settings[view-only]=false
settings[vnc-password]="'$vino_password_binary'"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# main
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# We need to have sudo enabled to do many of these tasks,
# this is a bit of a hack, but it gets the job done.
printf "Enabling sudo privileges...\n" >&2
echo $user_password | sudo -S whoami >/dev/null
printf "\n" >&2
# If vino is not installed, install it
if [ -z "$(dpkg -l | egrep -i 'vino')" ] ; then
printf "Installing vino...\n" >&2
sudo apt-get update
sudo apt-get install -y vino
fi
# Make sure we are performing these operations of the remotes display.
printf "Forwarding X org Display...\n" >&2
export DISPLAY=:0
sudo xhost +
# Loop through settings and configure vino.
for setting in "${!settings[@]}" ; do
current_value="$(gsettings get org.gnome.Vino "$setting")"
to_value="${settings[$setting]}"
if [[ "$current_value" != "$to_value" ]] ; then
printf "changing Vino's ${setting} from ${current_value} to ${settings[$setting]}\n" >&2
DISPLAY=:0 sudo gsettings set org.gnome.Vino "$setting" ${settings[$setting]}
fi
done
# Vino requires a reboot to work. If someone can find out how to do this with
# out rebooting or logging out, let me know.
sudo reboot