Adding a user
https://gist.github.com/sunapi386/9dc6eb841f1454733e02
Create a user
Then create the user; remember setting to his password to “chessman123”
sudo adduser binsun
Modifying guacamole’s user login data
Edit the user mapping, unless you’re using a database to store user logins.
sudo vi /etc/guacamole/user-mapping.xml
Create the entry like below, one for vnc and one for ssh.
<!-- User for binsun -->
<authorize username="binsun" password="chessman123">
<!-- First authorized connection -->
<connection name="vnc">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port">5904</param> <!-- Edit this -->
<param name="password">qwe123</param> <!-- Password for vncserver -->
<param name="encodings">zrle ultra copyrect hextile zlib corre rre raw</param>
</connection>
<!-- Second authorized connection -->
<connection name="ssh">
<protocol>ssh</protocol>
<param name="hostname">localhost</param>
<param name="port">22</param>
<param name="username">binsun</param> <!-- Edit this -->
<param name="password">chessman123</param> <!-- Edit this -->
</connection>
</authorize>
SSH Service
I assume the SSH service is already running on port 22, so that should already work.
Relaunching service
We just need to start the VNC service listening in on port 5903.
sudo /etc/init.d/tomcat7 restart
Restart hosting service so it loads the updated user-mapping.xml.
Logging
If logging in fails, check the log for login attempts.
tail -f /var/log/tomcat7/catalina.out
Setting up VNC
In the newly created user’s home directory, create a file called xstartup. This file is a script that gets run when the vncserver starts. Guacamole starts the vncservice.
First we switch to that user.
su binsun
Then create the startup script
mkdir ~/.vnc
chmod 700 ~/.vnc
cd ~/.vnc
vi xstartup
Put these in.
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
#/etc/X11/Xsession
startxfce4
And make this excutable.
chmod +x xstartup
While we’re still logged in as the user, start the vncserver
vncserver :4
This creates the service listening on 5904 port. You should be able to see it.
nmap -Pn localhost
Starting Nmap 6.40 ( http://nmap.org ) at 2015-10-19 21:40 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00055s latency).
Not shown: 988 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
631/tcp open ipp
3306/tcp open mysql
5902/tcp open vnc-2
5903/tcp open vnc-3
5904/tcp open unknown <------- this is it
6002/tcp open X11:2
6003/tcp open X11:3
6004/tcp open X11:4
6005/tcp open X11:5
8080/tcp open http-proxy
If you can’t get vnc started, look at this log.
tail -f /var/log/syslog