Skip to content

Instantly share code, notes, and snippets.

@daxxog
Last active August 16, 2019 16:18
Show Gist options
  • Save daxxog/012aad7c0396e6c0d69da00ecbcdcef4 to your computer and use it in GitHub Desktop.
Save daxxog/012aad7c0396e6c0d69da00ecbcdcef4 to your computer and use it in GitHub Desktop.
All in one script to config ssh and vnc for a local env.
#!/bin/bash
#sudo apt install -y curl
#curl -L tinyurl.com/ssh-0-dxg | sh
#curl -L tinyurl.com/dxg-0-ssh | sh
sudo apt update
sudo apt install -y openssh-server tightvncserver autocutsel openbox-lxde-session net-tools
#sshin config
curl -L bit.ly/29v2OyX | sh
#vnc setup
vncserver
vncserver -kill :1
curl -L https://gist.githubusercontent.com/daxxog/b8319785fc1c67a710b6d3e4bb677bba/raw/xstartup > $HOME/.vnc/xstartup
#fix "no session for pid"
#https://github.com/meefik/linuxdeploy/issues/826#issuecomment-316028269
sudo mv /usr/bin/lxpolkit /usr/bin/lxpolkit_old
#daemonize vnc and run vnc on startup
sudo touch /etc/init.d/vncd
curl -L https://gist.githubusercontent.com/daxxog/133c10cc2b06ce6d71b0ca033918abf1/raw/vncd-p1.sh > ~/._tmpvncd
echo "sudo -u ${USER} vncserver -kill :1 >> /dev/null &" >> ~/._tmpvncd
echo " sudo rm /tmp/.X1-lock >> /dev/null &" >> ~/._tmpvncd
echo " sudo rm /tmp/.X11-unix/X1 >> /dev/null &" >> ~/._tmpvncd
echo " sudo -u ${USER} -i nohup vncserver -geometry 1280x800 >> /dev/null &" >> ~/._tmpvncd
curl -L https://gist.githubusercontent.com/daxxog/c9b8aa077cef31c2cd7efa9e0a47a680/raw/vncd-p2.sh >> ~/._tmpvncd
echo "sudo -u ${USER} vncserver -kill :1 >> /dev/null &" >> ~/._tmpvncd
curl -L https://gist.githubusercontent.com/daxxog/1aa0885b640095c0189b0d52fdecf309/raw/vncd-p3.sh >> ~/._tmpvncd
sudo chown root ~/._tmpvncd
sudo mv ${HOME}/._tmpvncd /etc/init.d/vncd
sudo chmod 755 /etc/init.d/vncd
sudo update-rc.d vncd defaults
cat /etc/init.d/vncd
ifconfig | grep inet
echo ssh and vnc has been set up!
echo please reboot machine..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment