Automatic login to virtual console

From ArchWiki
Revision as of 18:06, 23 August 2005 by Acetylcholine (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Create a C login program, autologingeorge.c, for the user george:
int main() {
   execlp( "login", "login", "-f", "george", 0);
}

Here, the C function execlp executes the command login -f george.

  • Compile it:
# gcc -o autologingeorge autologingeorge.c
  • Gain root access (with su) and copy the executable to a public directory:
# cp autologingeorge /usr/local/sbin/
  • Edit /etc/ininttab. The lines:
c1:2345:respawn:/sbin/agetty 38400 vc/1 linux
c2:2345:respawn:/sbin/agetty 38400 vc/2 linux
c3:2345:respawn:/sbin/agetty 38400 vc/3 linux
c4:2345:respawn:/sbin/agetty 38400 vc/4 linux
c5:2345:respawn:/sbin/agetty 38400 vc/5 linux
c6:2345:respawn:/sbin/agetty 38400 vc/6 linux

should look something like:

c1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologingeorge 38400 vc/1 linux
c2:2345:respawn:/sbin/agetty 38400 vc/2 linux
c3:2345:respawn:/sbin/agetty 38400 vc/3 linux
c4:2345:respawn:/sbin/agetty 38400 vc/4 linux
c5:2345:respawn:/sbin/agetty 38400 vc/5 linux
c6:2345:respawn:/sbin/agetty 38400 vc/6 linux

Next time you start up your linux system, the user george will be automatically logged in on the first virtual console (vc/1). To understand why, do man agetty.

You can now Start X at boot and have your box go directly into X.