Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2124063
  • 博文数量: 229
  • 博客积分: 7217
  • 博客等级: 上校
  • 技术积分: 3224
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-19 17:23
个人简介

个人主页https://xugaoxiang.com,微信公众号: Dev_Club 或者搜索 程序员Club

文章分类

全部博文(229)

文章存档

2017年(1)

2016年(20)

2015年(23)

2013年(1)

2012年(23)

2011年(68)

2010年(62)

2009年(31)

分类: LINUX

2010-04-12 17:53:27

Ubuntu makes it easy to enable automatic login if you’re using a login manager such as GDM. I was recently setting up Ubuntu 9.10 Alternate version and it has no GDM. Here’s the method how I enabled automatic login on it.

Note: This was tested on Ubuntu 9.10. Previous versions of Ubuntu require different procedures because of changes to the way Ubuntu boots.

Open /etc/init/tty1.conf as root:
sudo vi /etc/init/tty1.conf

Change the last line of this file to (where USERNAME is the username of the user you want to log in):
exec /bin/login -f USERNAME < /dev/tty1 > /dev/tty1 2>&1

Reboot, and the user you chose should be logged in automatically after boot. If something goes wrong, you can switch to a different TTY with CTRL+ALT+F2 and log in normally.

If you want this user to be logged into a graphical environment instead of just a shell, there’s more work to be done. Open your user’s .bashrc file:
vi ~/.bashrc

Add the following to the end of the file:
if [ $(tty) == "/dev/tty1" ]; then
    startx
fi

This code will start X (the graphical environment) whenever the user logs in on TTY1. You can add more code after startx that will be executed if the user logs out of X.


djstava

阅读(3035) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~