Last active
August 29, 2015 14:24
-
-
Save jyalim/0ec0c1f1d52dd19f27c3 to your computer and use it in GitHub Desktop.
Remote access to Graphics Card on Ubuntu 14.04 or later
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Run with sudo | |
# Allow tcp forwarding through lightDM, username must be login name | |
username=$USER | |
if [[ $username == 'root' ]] && [[ -n $SUDO_USER ]]; then | |
username=$SUDO_USER | |
fi | |
confdir=/etc/lightdm/lightdm.conf.d | |
tcpconf=${confdir}/allow-tcp.conf | |
alogconf=${confdir}/autologin-user.conf | |
userconfdir=${HOME}/.config/autostart | |
lockscreen_user_conf=${userconfdir}/auto-screen-lock.desktop | |
! [[ -d $confdir ]] && sudo mkdir -p $confdir || : | |
! [[ -d $userconfdir ]] && mkdir -p $userconfdir || : | |
sudo cat <<- __EOF > $tcpconf | |
[SeatDefaults] | |
xserver-allow-tcp=true | |
__EOF | |
sudo cat <<- __EOF > $alogconf | |
[SeatDefaults] | |
autologin-user=$username | |
__EOF | |
# Next section auto-locks computer after auto-login, allowing graphics card | |
# to connect to desktop session and thus allowing remote user access to | |
# graphics card without compromising local security. | |
cat <<- __EOF > $lockscreen_user_conf | |
# Autolocks PC after automatic login | |
[Desktop Entry] | |
Type=Application | |
Name=Lock Screensaver | |
Exec=gnome-screensaver-command -l | |
__EOF | |
chown $username:$username $lockscreen_user_conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment