# autologin and auto run X server



## gulanito (Sep 4, 2009)

Hi.
I use freebsd as a desktop computer, so I want that when freebsd boots up, automatically login as user and run the X server.
What can I do that?

Thanks!


----------



## SirDice (Sep 4, 2009)

Both GDM and KDM can be configured this way.

For GDM:
http://www.freebsd.org/gnome/docs/faq2.html#q23


----------



## Xand_69 (Oct 2, 2009)

gulanito said:
			
		

> Hi.
> I use freebsd as a desktop computer, so I want that when freebsd boots up, automatically login as user and run the X server.
> What can I do that?
> 
> Thanks!



user - HouseMD
autologin to ttyv1
shell - csh

1. insert /etc/gettytab


```
al_HouseMD:\
        :ht:np:sp#115200:al_HouseMD:
```
2. edit /etc/ttys

```
ttyv1   "/usr/libexec/getty al_HouseMD"           cons25r on  secure
```
3 cd /home/HouseMD

insert .csh 

```
if  ($tty == ttyv1) then
  startx
  logout
endif
```
4. shutdown -r now

5. enjoy


----------



## segfault (Jul 22, 2012)

THis did not work for me (FreeBSD 9.0) and rendered my system unusable.
Did I do something wrong or was this a just sabotage?


----------



## wblock@ (Jul 22, 2012)

It is kind of an old thread.  Some things have changed in the last three years.  Here's my updated autologin setup: https://forums.freebsd.org/viewtopic.php?f=38&p=125787.


----------



## kpedersen (Jul 23, 2012)

I usually just create and add to /etc/rc.local


```
su -l myusername -c /usr/local/bin/startx &
```

On some installs it seems to lock up keyboard input (I think the getty / login takes input focus) so I also replace the startx with a script that sleeps for about 5 seconds and then starts X11.

Remember to add the '&' or it may prevent other services from starting.


----------

