limontec

vnc-startup.sh

Feb 11th, 2020
1,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.45 KB | None | 0 0
  1. # ##################################################################
  2. # Script Name : vnc-startup.sh
  3. # Description : Perform an automated install of X11Vnc
  4. #               Configure it to run at startup of the machine            
  5. # Date : Feb 2016
  6. # Written by : Griffon
  7. # Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
  8. # Version : 1.0
  9. #
  10. # Disclaimer : Script provided AS IS. Use it at your own risk....
  11. #
  12. # #################################################################
  13.  
  14. # Step 1 - Install X11VNC  
  15. # #################################################################
  16. sudo apt-get install x11vnc -y
  17.  
  18. # Step 2 - Specify Password to be used for VNC Connection
  19. # #################################################################
  20.  
  21. sudo x11vnc -storepasswd /etc/x11vnc.pass
  22.  
  23.  
  24. # Step 3 - Create the Service Unit File
  25. # #################################################################
  26.  
  27. cat > /lib/systemd/system/x11vnc.service << EOF
  28. [Unit]
  29. Description=Start x11vnc at startup.
  30. After=multi-user.target
  31.  
  32. [Service]
  33. Type=simple
  34. ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
  35.  
  36. [Install]
  37. WantedBy=multi-user.target
  38. EOF
  39.  
  40. # Step 4 -Configure the Service
  41. # ################################################################
  42.  
  43. echo "Configure Services"
  44. sudo systemctl enable x11vnc.service
  45. sudo systemctl daemon-reload
  46.  
  47. sleep  5s
  48. sudo shutdown -r now
Add Comment
Please, Sign In to add comment