自動登入linux(不使用登入管理器)
阿新 • • 發佈:2019-02-20
Are you tired off typing logins? Don't want to load heavy/waste of time login managers?
This guide let's you have autologin and autostart for your XFCE:
Let's open a console and then create the file autologin.c
Code:
Code:
replace the string: your_user_here with the user you want to autologin. (ctrl+X to save) btw, use your prefered editor.
Let's compile.. you will need to have gcc installed:
Code:
Code:
now we need to edit the file /etc/inittab
Code:
Code:
Code:
Code:
this will make the autologin stuff...
let's make the autostart:
Code:
Code:
then you just have to remove your login manager :
Code:
I used this page as guide:
http://www.dicas-l.unicamp.br/dicas-l/20030129.shtml
This guide let's you have autologin and autostart for your XFCE:
Let's open a console and then create the file autologin.c
Code:
sudo nano autologin.cand paste this code inside (middle mouse button will paste the text you underline):
Code:
int main() { execlp( "login", "login", "-f", "your_user_here", 0); }
Let's compile.. you will need to have gcc installed:
Code:
sudo gcc -o autologin autologin.ccopy the compiled autologin file into /usr/local/sbin
Code:
sudo cp autologin /usr/local/sbin
Code:
sudo nano /etc/inittabsearch for this:
Code:
1:2345:respawn:/sbin/getty 38400 tty1put a # to comment this line and add this new line:
Code:
1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologin 38400 tty1it will look like this:
Code:
#1:2345:respawn:/sbin/getty 38400 tty1 1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologin 38400 tty1 2:23:respawn:/sbin/getty 38400 tty2 3:23:respawn:/sbin/getty 38400 tty3 4:23:respawn:/sbin/getty 38400 tty4 5:23:respawn:/sbin/getty 38400 tty5
let's make the autostart:
Code:
nano .bash_profileput this code on the bottom and save it
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then startxfce4 fi
then you just have to remove your login manager :
Code:
sudo apt-get remove gdm xdm kdmreboot your machine
I used this page as guide:
http://www.dicas-l.unicamp.br/dicas-l/20030129.shtml