Skip to content

Instantly share code, notes, and snippets.

@QinMing
Last active December 3, 2015 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QinMing/90e07aad6e33ef0ccf04 to your computer and use it in GitHub Desktop.
Save QinMing/90e07aad6e33ef0ccf04 to your computer and use it in GitHub Desktop.
Ubuntu Remote Desktop

This can be done. Following are the steps to setup the GUI

Create new user with password login. (But a new user is actually not needed)

sudo useradd -m awsgui
sudo passwd awsgui
sudo usermod -aG admin awsgui
sudo vim /etc/ssh/sshd_config # edit line "PasswordAuthentication" to yes
sudo /etc/init.d/ssh restart

Setting up ui based ubuntu machine on AWS. In security group open port 5901. Then ssh to the server instance. Run following commands to install ui and vnc server:

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server

Then run following commands and enter the login password for vnc connection:

vncserver
# actually, now the vnc client should be able to connect and see a gnome terminal
vncserver -kill :1
vim awsgui/.vnc/xstartup

Then hit the Insert key, scroll around the text file with the keyboard arrows, and delete the pound (#) sign from the beginning of the two lines under the line that says "Uncomment the following two lines for normal desktop." And on the second line add "sh" so the line reads exec sh /etc/X11/xinit/xinitrc. (this may not be correct) Then start vnc server again. vncserver In the vnc client, give public DNS plus ":1" (e.g. www.example.com:1). Enter the vnc login password. Make sure to use a normal connection. Don't use the key files.

Additional guide available here: http://www.serverwatch.com/server-tutorials/setting-up-vnc-on-ubuntu-in-the-amazon-ec2-Page-3.html

Mac VNC client can be downloaded by yourself

gray screen problem

sudo apt-get install dconf-tools not sure if there's any effect

Change ~/.vnc/xstartup. Not sure. Mess around and try. See the other file.

Don't know what's these

export XKL_XMODMAP_DISABLE=1
unset DBUS_SESSION_BUS_ADDRESS

Look at ~/.vnc/*.log

Install missing packages.

If see "permission denied" at /run/user/1000, try sudo chown -R <user name> 1000/. This solves the problem that windows can't be dragged.

start X11 and DBUS or something.

When running sudo software-center I got errors about X11 and DBUS. So in xstartup add exec sh /etc/X11/xinit/xinitrc. Then permision denied. Change ownership. sudo chown ubuntu /etc/X11/xinit/xinitrc, chmod +x , but still gray screen after exec xinitrc

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# have effect?
unset DBUS_SESSION_BUS_ADDRESS
# seems like starting X11 is necessary. But adding this line will make gray screen. Why?
# exec sh /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
# no use actually
xsetroot -solid grey
#No clipboard support w/o this line
vncconfig -iconic &
# just a terminal
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# gnome-terminal &
# Like "This Computer"?
x-window-manager &
# needed before gnome-panel?
gnome-session &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment