Created
May 17, 2011 20:21
-
-
Save smoser/977297 to your computer and use it in GitHub Desktop.
x2go versus vnc
This file contains 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
#!/bin/sh | |
# run ami-e945739d | |
# eu-west-1 ami-e945739d canonical ubuntu-natty-daily-i386-desktop-20110508 | |
% sudo apt-add-repository ppa:x2go/ppa | |
% sudo apt-get update | |
% sudo apt-get install x2goserver tightvncserver unity-2d | |
% pass="foo.bar-123" | |
% mkdir skel/.vnc | |
% xsess=gnome-2d | |
% xsess=unity-2d # in /usr/share/xsessions/ | |
% geometry="800x600" | |
% cat > skel/.vnc/xstartup <<EOF | |
#!/bin/sh | |
exec awstrial-xsession unity-2d | |
EOF | |
% cat > skel/vncserver-start <<EOF | |
vncserver -geometry ${geometry} ${1:-:0} | |
EOF | |
% cat > skel/README <<EOF | |
client needs: | |
* python-x2go | |
EOF | |
% cat > skel/start-x2go-client | |
#!/usr/bin/python | |
import x2go, sys | |
(username, server, port, session, password, geometry ) = ( sys.argv[1:7] ) | |
add_to_known_hosts=True | |
cmd="awstrial-session %s" % session | |
cli = x2go.X2goClient() | |
uuid = cli.register_session( | |
server=server, port=int(port), | |
username=username, add_to_known_hosts=add_to_known_hosts, | |
cmd="TRIAL", geometry=geometry, | |
) | |
x2go.defaults.X2GO_DESKTOPSESSIONS['TRIAL']=cmd | |
#cli.connect_session(uuid, password=password) | |
cli.connect_session(uuid, force_password_auth=False) | |
cli.clean_sessions(uuid) | |
cli.start_session(uuid) | |
while cli.session_ok(uuid): | |
time.sleep(0.5) | |
cli.suspend_session(uuid) | |
EOF | |
% cat > skel/start-vncserver-client | |
EOF | |
% chmod 755 skel/vncserver-start | |
% rsync -a ~/.ssh/ skel/.ssh | |
% echo "${pass}" | vncpasswd -f > "vncd/passwd" | |
% chmod 755 vncd/xstartup | |
% for u in vnc x2go; do \ | |
sudo adduser --gecos "$u user" --disabled-password $u-user; \ | |
printf "$u-user:$pass\n" | sudo chpasswd ; \ | |
sudo rsync -a skel/ /home/$d/ && chown -R $u:$u /home/$u/ ; \ | |
done | |
% asurl="http://bazaar.launchpad.net/~awstrial-dev/awstrial-tools/trunk/download/head:/awstrialxsession-20110413171002-5k6u6vrtcprn2x3w-1/awstrial-xsession" | |
% wget "$asurl" -O awstrial-xsession | |
% sudo cp awstrial-xsession /usr/bin | |
% sudo chmod 755 /usr/bin/awstrial-xsession |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment