Q:

I am logged out immediately after logging in

After I log in to my user account on Ubuntu 13.04, I get automatically logged out after 1 second of black screen. This happens only with 1 specific user, and I can log in to another account fine.
What could have gone wrong? In which log files should I find my answer?
I installed a VNC server and turned on desktop sharing, and last time I could log in - maybe that is an issue. How can I disable it without GUI?

A:

I  don't know if it would be exactly the same case, but this happened to me because somehow I corrupted the .Xautority file in my home. I think it's something related with remote access to the X server.
Log into a tty (Control+Alt+F6) and after typing your username and password:
sudo rm -v .Xauthority

The .Xauthority file is in /home/, which is where the terminal's default working path also usually is. If you use a tty to sign in as one user to delete another's .Xauthority file, make sure you've cd'd to the right directory first.
Then restart lightdm with:
sudo service lightdm restart

The sistem will recreate the .Xautority file.

A:

For me the immediately logout problem was caused by an error in ~/.profile. I am using 13.10. The (approximate) solution is found here or here. You can change or delete the file causing problems by pressing ctrl + alt + F6 and logging in that way.

