Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed minimal Ubuntu 12.10. I want this environment to take as little disk space as possible, so I didn't install a desktop and am doing everything via console. I want to auto-login to the system when it is booted. I discovered a method for auto-login, but I do not fully understand it.

I edited the file /etc/init/tty1.conf and changed the last line from

exec /sbin/getty -8 38400 tty1

to

exec /bin/login -f username < /dev/tty1 > /dev/tty1 2>&1

...where "username" is the name of the user to login. It works perfectly, but why? I understand "login -f username" and redirection, but I don't see where the auto-login magic is happening.

Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Most of the answer is found in the man page: man login.

In your original command, getty does some setup (see the man page) prompts for a login name, and invokes login. In your new command, you're bypassing getty and invoking login directly. The key is the -f option. The manual says of it:

Do not perform authentication, user is authenticated. Note: In that case, username is mandatory.

Since login is the program that handles logins, it can easily bypass authentication if necessary.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.