samba

enabling remote desktop via CLI

May 24th, 2010
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # goal: a rather forceful way of enabling remote desktop with a known configuration
  4. # pastebin uses \r (DOS format), so you'll have to fix that when deploying this...
  5. #    tr -d '\r' < dosfile.txt > unixfile.txt
  6.  
  7. # disable requiring local confirmation
  8. gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
  9.  
  10. # set remote control (not view only)
  11. gconftool-2 -s -t bool /desktop/gnome/remote_access/view_only false
  12.  
  13. # let the local session continue after I'm gone...
  14. gconftool-2 -s -t bool /desktop/gnome/remote_access/lock_screen_on_disconnect false
  15.  
  16. # optionally set a different port
  17. read -p "VNC Listening Port (standard: 5900; blank: don't set the alternative): " port;
  18. if [ -z "$port" ]; then
  19.     gconftool-2 -s -t bool /desktop/gnome/remote_access/use_alternative_port false
  20. else
  21.     gconftool-2 -s -t int /desktop/gnome/remote_access/alternative_port $port
  22.     gconftool-2 -s -t bool /desktop/gnome/remote_access/use_alternative_port true
  23. fi
  24.  
  25.  
  26. # enable password auth
  27. read -p "VNC Password (required): " -s password;
  28. gconftool-2 --type list --list-type string --set /desktop/gnome/remote_access/authentication_methods '[vnc]'
  29. gconftool-2 --type string --set /desktop/gnome/remote_access/vnc_password "$(echo "$password" | base64)"
  30.  
  31.  
  32. # enable remote desktop
  33. gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
Add Comment
Please, Sign In to add comment