You need to type
sudo chown instead of
chown to gain permission. You will be asked for a password. The device should be mounted at (example) /media/username/devicename .
sudo chown -R username:username /media/username/devicename
sudo chmod -R 777 /media/username/devicename
If that doesn't work, use sudo to unmount the device like this:
sudo umount /media/username/devicename && sudo -K
and then remount the device by removing and reinserting it.
(you will need to change "username" and "devicename" to the actual names)
Another trick that sometimes works is to insert the device and reboot Ubuntu. When you boot and then log in, the device should automount with all the proper permissions.
Finally, if it's an sd card, don't forget about the lock switch on the side of the device.
Please post any errors.