VNC server
With SSH you can access only terminal, but sometimes I need to see a GUI. For this, the most popular is VNC - a system to share remote access to desktop. In Raspbian repository you can find package "tightvnc" which represents VNC server. To install, issue:
apt-get install tightvncserver
When VNC is installed, create a session.
vncserver :1 -geometry 1024x728 -depth 24
This will create new VNC session 1. It is not a port number, it is session ID! Also set resolution and color depth for the session. After first start you will be asked for password. Type some, it shouldn`t be the same as your account password. Now when session is created, you can connect via VNC client from another computer. For Windows hosts, I like TightVNC client the most (here). Fill your RPi`s IP address and session ID.
Click connect and fill password previously set password...
Now you should see RPi`s desktop.
When you want stop exit VNC, simply close TightVNC client, there is no need to logout or anything like that. To change VNC password simply execute:
vncpasswd
...set new password and restart VNC server. I don`t know reason but TightVNC server has no script for start/stop/restart in "init.d", so here is a little workaround...
killall Xtightvnc #stop VNC server
vncserver :1 -geometry 1024x728 -depth 24 #start VNC server
To start listening VNC session, simply use crontab...
crontab -e
And add previous command.
@reboot sudo -u root vncserver :1 -geometry 1024x728 -depth 24
Close the file (CTRL+X...) and save changes (...press "y" and Enter). Since VNC is using session ID to identify session, you can have many sessions for every user. For example, to add new session for user "user" issue this commands.
sudo -u user vncpasswd
And add this to "crontab -e":
sudo -u user vncserver :2 -geometry 1024x728 -depth 24
By default VNC server uses TCP port number 5900 + session ID. In case of session ID 1, port will be TCP 5901.