Although it's probably fine to (re)take ownership of everything in your home directory, the specific reason you were unable to start Firefox is that your Firefox profile was inaccessible when you didn't run firefox with sudo.Therefore, I recommend retaking ownership of just the folder that contains your Firefox profile and other user-specific Firefox data (like your Firefox extensions):

sudo chown -R $USER:$USER ~/.mozilla

That will work if you enter it exactly as written. Or, if you like, you can replace $USER with your username. If you do that, make sure you do not keep the $.

(You may also use $(whoami):$(whoami) instead of $USER:$USER, as in L.D. James's answer, if you want.)

Make sure Firefox is not running when you execute that command.

Then open Firefox. It should run, now.


Your problem was most likely caused by running Firefox with sudo in the first place. In the case of a program like Firefox, you should just not run it as root -- there is never really any situation where it would be useful to do so.

In general, however, if you find you must run a graphical application as root, you should almost never use plain sudo for that, since it causes any configuration files the application creates to be owned by the root user but still be created in your home directory rather than root's.

Instead, you can use gksu, gksudo, kdesudo (on Kubuntu), sudo -H, or sudo -i when you encounter a situation where you must run a graphical program as root. However, I emphasize that running programs as root is for system administration. You might decide to run a text editor as root to edit the system's configuration files, but you never need to, and never should, run a program like a web browser or word processor as root.


You have configuration files in your home directory that you don't have access to.

This is a result of running sudo on programs using your personal space. Sudo should only be run when you are intentionally making system wide changes on the system.

You can verify this with:
(I would discourage using sudo in your personal space. You can find files and folders that are not owned by your account without elevated access. If no output, there no need to run sudo. Some users mightnot even have sudo access, and would get a warning and notice to the administrator just by testing it.)

$ find ~/ -mount ! -user $(whoami)

You can correct this with:

$ sudo chown -R $(whoami):$(whoami) ~/

Note:

The problem you are having in this case is your Firefox application. You are noticing it because you find you are loosing functionality because of this problem. Taking ownership of all the personal files in your space may correct other problems that you are having, but haven't identified yet.

It's customary to use a space outside of your home folder for files with permission outside of your own ownership. A conventional place to put those files is in /opt, or /usr/local/bin for executional. It's unlikely that you will break your system by owning your files in your home folder. It is likely that some components may be broken by you not owning files in your home space.

Running sudo is the culprit of many problems, and should be run with care.