Editing .bash_profile cause GUI crash

Latest response

Our Server is started in Runlevel 3. I want to Setup an user, so that when he logs in, it starts the GUI and TeamViewer. I added at the end of .bash_profile, startx. When I log in, the GUI starts. I then set up TeamViewer to start, with StartProgram. Then exited. At the next log in, TeamViewer starts sometimes, but most of the time not. If I take the startx out of .bash_profile and log in and then startx, TeamViewer starts all the time. TeamViewer only works this way too.
When I have the startx in .bash_profile and TeamViewer starts, as soon as I make a Connection from my Workstation to Server, TeamViewer quits and the GUI crashes, black Screen. I can make the Connection from Server to Workstation though, that seems to work fine. Without the startx in .bash_profile, it always works fine.

I have Teamviewer 12.0.76279 installed on a RHEL 7.3 Server.

Responses