Unable to upload code to Arduino Uno on Ubuntu 14.04

I recently bought an Arduino, and am new to Arduino. I am running Ubuntu 14.04, and I installed the Arduino IDE 1.6.8 by following the instructions from here:

and of course modifying the commands for 1.6.8 .I connected the board to my laptop, and the "ON" indicator lit up. Another orange indicator started blinking. I started up the IDE. Tools>Board was set to Arduino/Genuino UNO, and I set the Port to /dev/tty/ACM0. I opened the example File>Examples>Basics>Blink, and compiled it. I then tried to upload it. I received the following error message:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device

Is there any way to permanently solve this problem?

Nevermind I found the solution. You just have to add yourself to the dialout group by running:

sudo usermod -a -G dialout yourusername

and then logging out and back in.