Setup Auto Login on Raspbian


4 posts
by fosterb » Mon Oct 29, 2012 12:17 pm
I'm trying to get my pi setup so that I can power it on and then remote to it via TightVNC without a keyboard or mouse being plugged into it. Everything seems to work now apart from the fact that I have to plug a keyboard in to type in the login details before I can connect through VNC. I've seen a setting in the /etc/lightdm/lightdm.conf which was commented out to do with autologin-user and I tried setting to be autologin-user=pi (not commented out) and this didn't seem to have any effect.

Anyone have any ideas how I can do this?
Posts: 5
Joined: Fri Oct 26, 2012 11:07 am
by Dweeber » Mon Oct 29, 2012 12:24 pm
Create a start up script for TightVNC and set it up... each time you reboot, TightVNC will be running for you to access.

You can set it up to use the pi user or root depending on what you want.

I run headless on all my units (except the one by the TV which is connected to the TV only)... wireless as well. No keyboards, mice, LAN cables...

There are a number of articles on how to do it in the Wiki, and posted on the forms. Use Google to find them.

I have basic instructions for my clients at: http://rpi.tnet.com/project/faqs/tightvncserver - Setup to run as root.
Dweeber A.K.A. Kevin...
My RPI Info Pages including Current Setup - http://rpi.tnet.com
User avatar
Posts: 606
Joined: Fri Aug 17, 2012 3:35 am
Location: Mesa, AZ
by fosterb » Mon Oct 29, 2012 1:25 pm
I had already setup a startup script for vnc like the one you've got, and it starts up fine, but unless I login manually after the startup routine finishes I can't connect. Do I need to pass in the login details to vnc somehow? Can't see anywhere for them to go.
Posts: 5
Joined: Fri Oct 26, 2012 11:07 am
by fosterb » Mon Oct 29, 2012 2:17 pm
I've just had a closer look at your script and it is slightly different to mine. I've modified mine from this:

Code: Select all
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

#! /bin/sh
# /etc/init.d/vncboot

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting VNC Server"
   #Insert your favoured settings for a VNC session
   /usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565
   ;;

 stop)
   echo "Stopping VNC Server"
   /usr/bin/vncserver -kill :1
   ;;

 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac
exit 0


to this:

Code: Select all
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

#! /bin/sh
# /etc/init.d/vncboot

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting VNC Server"
   #Insert your favoured settings for a VNC session
   su root -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565'
   ;;

 stop)
   echo "Stopping VNC Server"
   /usr/bin/vncserver -kill :1
   ;;

 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac
exit 0


The vnc server now starts as root. I get a connection now, which is an improvement, but the vnc screen is blank, I've got options at the top but nothing in the middle of the page.

Any ideas?
Posts: 5
Joined: Fri Oct 26, 2012 11:07 am