Use
xev
And press the key Right Control. You will get an event like this:
KeyPress event, serial 36, synthetic NO, window 0x4200001,
root 0x266, subw 0x0, time 253995826, (1344,552), root:(1410,604),
state 0x10, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
Remember the keycode, in my case 105.
Create a script, for example /home/user/xmodmap.sh with the following:
#!/bin/bash
xmodmap -e "keycode 105 = Caps_Lock"
Now give permissions to the script with:
sudo chmod 755 /home/user/xmodmap.sh
And add it to be run when your Ubuntu starts going to System -> Preferences -> Startup Applications and creating a new entry with the command:
/bin/bash -c "sleep 5 && /home/user/xmodmap.sh"