设置X的鼠标主题
配置samba的访问密码和用户名
自动登录linux(不使用登录管理器)
獨立的圓 posted @ 2008年7月05日 01:03 in Linux with tags linux , 5822 阅读
本站文章已轉移,敬請移步:http://www.xxb.me/ ,謝謝!
本文是指自动登录X
方法一:
编辑/etc/inittab,确保启动级别为5,即:
id:5:initdefault:
并且在最后面添加一行:
x:5:once:/bin/su username -l -c "/bin/bash --login -c startx >/dev/null 2>/dev/null"
(注:要把原来类似的那行注释掉,username替换为要自动登录的用户名)
另外要取消GDM之类的登录管理器自动运行,最后重启即可。
方法二:
源代码:
int main
(
)
{
execlp ( "login", "login", "-f", "your_user_here", 0 );
}
execlp ( "login", "login", "-f", "your_user_here", 0 );
}
保存为autologin.c,其中your_user_here替换为要自动登录的用户名,然后编译并安装之:
$ gcc autologin.c -oautologin
$ sudo cp autologin /usr/sbin/autologin
$ sudo cp autologin /usr/sbin/autologin
配置 /etc/inittab
确保启动级别为3
然后修改
c1:2345:respawn:/sbin/agetty -8 38400 vc/1 linux
为
c1:2345:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 vc/1 linux
配置 ~/.bash_profile
添加:
if
[ -z
"$DISPLAY"
] &&
[ $
(tty
) == /dev/vc/
1
];
then
startx
fi
startx
fi
最后重启即可。
无论哪种方法,注销后都会回到文本界面,运行startx即可启动X并自动登录,请在~/.xinitrc里指定使用的桌面管理器。
附我的~/.xinitrc:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#
source ~/.xprofile
DEFAULTSESSION=startlxde
case "$1" in
"LXDE" )
exec startlxde
;;
"GNOME" )
exec gnome-session
;;
"KDE" )
exec startkde
;;
"XFCE4" )
exec startxfce4
;;
"ICEWM" )
exec icewm-session
;;
"FLUXBOX" )
exec startfluxbox
;;
* )
exec $DEFAULTSESSION
;;
esac
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#
source ~/.xprofile
DEFAULTSESSION=startlxde
case "$1" in
"LXDE" )
exec startlxde
;;
"GNOME" )
exec gnome-session
;;
"KDE" )
exec startkde
;;
"XFCE4" )
exec startxfce4
;;
"ICEWM" )
exec icewm-session
;;
"FLUXBOX" )
exec startfluxbox
;;
* )
exec $DEFAULTSESSION
;;
esac
方法二参考:HOWTO: Autologin and Autostart XFCE (just pushing power button)
- 版权所有,转载请遵循“署名-非商业用途-保持一致”创作共用协议。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HOWTO: Autologin and Autostart XFCE without login managers
HOWTO: Autologin and Autostart XFCE without login managers
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:
sudo nano autologin.c
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.c
Code:
sudo cp autologin /usr/local/sbin
Code:
sudo nano /etc/inittab
Code:
1:2345:respawn:/sbin/getty 38400 tty1
Code:
1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologin 38400 tty1
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_profile
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 kdm I used this page as guide: http://www.dicas-l.unicamp.br/dicas-l/20030129.shtml Last edited by peekpt; May 2nd, 2005 at 05:18 PM.. |
|
May 5th, 2005 | #2 |
Just Give Me the Beans!
Join Date: May 2005
Beans: 68
Ubuntu 6.10 Edgy
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
All I did was install Xfce with synaptic and then opened up the Login Screen Setup which can be found under Settings and clicked on Auto Login and selected a user.
|
May 6th, 2005 | #3 |
First Cup of Ubuntu
Join Date: May 2005
Beans: 2
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
abowman, I think you missread the title of his thread.
His howto is the *efficient way of loading xfce on a light system. The various, login managers, utilise memory in the background. Salut. |
May 6th, 2005 | #4 |
Ubuntu Extra Shot
Join Date: Dec 2004
Location: Braga-Portugal
Beans: 334
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
I'll try it... But if i screw my Ubuntu... I'LL KICK YOUR ***!!! (gently!)
Just kidding!
__________________
Linux user #383892
(\ /)
(O.o) (> <) This is Bunny. Copy Bunny into your signature to help him on his way to world domination. |
May 6th, 2005 | #5 | |
First Cup of Ubuntu
Join Date: Apr 2005
Beans: 4
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
Quote:
xfce rox... |
|
May 30th, 2005 | #6 | |
5 Cups of Ubuntu
Join Date: May 2005
Beans: 20
Ubuntu Breezy 5.10
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
Quote:
|
|
March 16th, 2006 | #7 |
Just Give Me the Beans!
Join Date: Mar 2006
Location: Germany
Beans: 59
Ubuntu 10.10 Maverick Meerkat
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
Works even better when you uses "startx" instead of "startxfce4" in the ~/.bash_profile
Otherwise I got problems with font savings etc. Looks like this (compared with first post here):
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then startx fi |
March 19th, 2006 | #8 |
Just Give Me the Beans!
Join Date: Aug 2005
Location: ON, Canada
Beans: 46
Ubuntu UNR
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
This is a great idea! I have a few problems though. When I turn on the computer the autologin works and then xfce4 will begin to load. After a few milliseconds though it boots me out to the command line again and I have to type "sudo startx". Then everything runs as root. What did I do wrong?
Nevermind, I was wrong. It works now. Last edited by conor; March 21st, 2006 at 05:54 PM.. |
March 29th, 2006 | #9 |
Quad Shot of Ubuntu
Join Date: May 2005
Location: Marlborough, UK
Beans: 483
Ubuntu Karmic Koala (testing)
|
Re: HOWTO: Autologin and Autostart XFCE (just pushing power button)
If you are using a newer version of ubuntu you will need to
Code:
sudo apt-get install gcc-3.4
Code:
sudo gcc -o autologin autologin.c
Code:
sudo gcc-3.4 -o autologin autologin.c
__________________
Regards, Haegin If all else fails curl up in bed with a good book. " |