How To Wiki
(Corrected gcc-4.2.3 error report)
m (→‎Steps: categorizing Linux articles)
 
(13 intermediate revisions by 6 users not shown)
Line 8: Line 8:
 
==Steps==
 
==Steps==
 
You may not boot up if this isn't done properly, and these steps may not be the same for your computer
 
You may not boot up if this isn't done properly, and these steps may not be the same for your computer
# edit a file: for example 'autologinz.c', and add
+
# edit a file: for example 'autologinz.c', and add (zymos being the username)
#: #include <unistd.h>
+
#: #include &lt;unistd.h&gt;
 
#: int main() { execlp( "login", "login", "-f", "zymos", 0); }
 
#: int main() { execlp( "login", "login", "-f", "zymos", 0); }
 
# Compile the file by executing this command:
 
# Compile the file by executing this command:
 
#: gcc -o autologinz autologinz.c
 
#: gcc -o autologinz autologinz.c
 
# make sure autologinz is executable. For help See: [[Howto to change file permissions in unix]]
 
# make sure autologinz is executable. For help See: [[Howto to change file permissions in unix]]
# chmod 644 autologinz
+
# chmod 755 autologinz
 
# as root, perform the next steps:
 
# as root, perform the next steps:
 
# copy the program you just created to /usr/local/sbin
 
# copy the program you just created to /usr/local/sbin
 
# cp autologinz /usr/local/sbin
 
# cp autologinz /usr/local/sbin
  +
# Read NOTE! below before proceeding!
 
# edit '/etc/inittab', and on line that looks similar to the following
 
# edit '/etc/inittab', and on line that looks similar to the following
#: c1:2345:respawn:/sbin/agetty 38400 tty1 linux or
+
#: c1:2345:respawn:/sbin/agetty 38400 tty1 linux
  +
#: or
 
#: 1:2345:respawn:/sbin/mingetty tty1
 
#: 1:2345:respawn:/sbin/mingetty tty1
 
# Replace that line with the following using the location of your executable
 
# Replace that line with the following using the location of your executable
  +
#: c1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinz 38400 tty1
  +
#: or
 
#: 1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinz 38400 tty1
 
#: 1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinz 38400 tty1
 
# reboot
 
# reboot
#* If you computer does not boot up properly use you boot disk to replace the line in '/etc/inittab' to its original and read 'man getty'<div id="wikia-credits"><br /><br /><small>From [http://howto.wikia.com HowTo Wiki], a [http://www.wikia.com Wikia] wiki.</small></div>
+
NOTE! If your computer does not boot up properly use your boot disk to replace the line in '/etc/inittab' to its original and read 'man getty'<div id="wikia-credits"><br /><br /><small>From [http://howto.wikia.com HowTo Wiki], a [http://www.wikia.com Wikia] wiki.</small></div>
 
 
 
 
[[Category:Howto]]
 
[[Category:Howto]]
  +
[[Category:Linux]]

Latest revision as of 19:15, 15 October 2010

This howto show you howto get Linux to auto login in multi-user mode(non-GUI) at bootup.

Difficulty Operating Systems
med/hard linux
About:Ratings

Requirements

  • getty, or agetty; any getty that supports executing files (mingetty does not)
  • gcc: usually standard http://gcc.gnu.org
  • a boot disk or live cd is a good idea. If you make a mistake your computer may not boot up properly.

Steps

You may not boot up if this isn't done properly, and these steps may not be the same for your computer

  1. edit a file: for example 'autologinz.c', and add (zymos being the username)
    #include <unistd.h>
    int main() { execlp( "login", "login", "-f", "zymos", 0); }
  2. Compile the file by executing this command:
    gcc -o autologinz autologinz.c
  3. make sure autologinz is executable. For help See: Howto to change file permissions in unix
  4. chmod 755 autologinz
  5. as root, perform the next steps:
  6. copy the program you just created to /usr/local/sbin
  7. cp autologinz /usr/local/sbin
  8. Read NOTE! below before proceeding!
  9. edit '/etc/inittab', and on line that looks similar to the following
    c1:2345:respawn:/sbin/agetty 38400 tty1 linux
    or
    1:2345:respawn:/sbin/mingetty tty1
  10. Replace that line with the following using the location of your executable
    c1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinz 38400 tty1
    or
    1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinz 38400 tty1
  11. reboot

NOTE! If your computer does not boot up properly use your boot disk to replace the line in '/etc/inittab' to its original and read 'man getty'



From HowTo Wiki, a Wikia wiki.