Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-18-2005, 12:57 PM
|
#1
|
LQ Newbie
Registered: Aug 2005
Posts: 4
Rep:
|
autologin without GUI
Ok, here's what I'm doing...
I have Debian 3.10 installed on a kiosk machine. I want it to automatically log in as a user so that if there's a power outage, wo don't have to walk around with a keyboard unlocking each kiosk and logging in.
We are NOT using GDM, KDM, etc. If we were, I wouldn't be asking this. We are using XFree86 and fvwm for the window manager. That's it. The only other software is firefox and whatever is installed as a bare minimum (ssh, etc...). Thanks in advance!
|
|
|
10-18-2005, 02:08 PM
|
#2
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Here's some notes from an article at http://www.linuxgazette.com/issue72/chung.html
Create a file named autologinfred.c and type in this short C program:
Code:
int main() {
execlp( "login", "login", "-f", "fred", 0);
}
Run these commands:
gcc -o autologinfred autologinfred.c
chmod 755 autologinfred
cp autologinfred /usr/local/sbin/
Edit /etc/inittab and change the line beginning with "1:2345" so that it reads as follows:
1:2345:respawn:/sbin/getty -n -l /usr/local/sbin/autologinfred 38400 tty1
On some GNU/Linux distributions (like RedHat) /sbin/agetty must be used instead.
1:2345:respawn:/sbin/agetty -n -l /usr/local/sbin/autologinfred 38400 tty1
Make sure the default run level in /etc/inittab is init 1 or init 3
id:3:initdefault:
|
|
1 members found this post helpful.
|
11-04-2005, 03:34 AM
|
#3
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
any idea why it doesn't seem to work right on slackware??
instead of automatically logging-in a user, it just asks for the password... like, at boot it will say "Password: " (without prompting for a username) and if you give it the password for the user you wanted to auto login it will then drop you to the shell like normal... the only way to log-in as another user is to switch to another console...
this is what my /etc/inittab looks like:
Code:
# These are the standard console login getties in multiuser mode:
#c1:1235:respawn:/sbin/agetty 38400 tty1 linux
c1:1235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty1 linux
c2:1235:respawn:/sbin/agetty 38400 tty2 linux
c3:1235:respawn:/sbin/agetty 38400 tty3 linux
c4:1235:respawn:/sbin/agetty 38400 tty4 linux
c5:1235:respawn:/sbin/agetty 38400 tty5 linux
c6:12345:respawn:/sbin/agetty 38400 tty6 linux
my autologin.c file looks like:
Code:
int main() {
execlp( "login", "login", "-f", "win32sux", 0);
}
and i compiled it using:
Code:
gcc autologin.c -o autologin
the permissions for my binary look like:
Code:
-rwxr-xr-x 1 root bin 11066 2005-11-04 03:57 /usr/sbin/autologin
any ideas would be greatly appreciated... 
|
|
1 members found this post helpful.
|
11-04-2005, 06:04 AM
|
#5
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
seems the reason it wouldn't work is because i needed to set the NO_PASSWORD_CONSOLE option in /etc/login.defs...
everything is working fine now... i set 3 ttys, tty3 being the one that is autologin...
this is what my working setup looks like now:
/etc/login.defs:
Code:
NO_PASSWORD_CONSOLE tty3
/etc/inittab:
Code:
c1:1235:respawn:/sbin/agetty 38400 tty1 linux
c2:1235:respawn:/sbin/agetty 38400 tty2 linux
c3:235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty3 linux
~/.bash_profile:
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty3 ]; then
startx
fi
/etc/securetty (i commented all ttys except tty1): in the inittab i removed the "1" from the c3 line as i don't want the auto login tty3 to be up when i go to runlevel 1 (single user mode)...
Last edited by win32sux; 11-04-2005 at 07:36 PM.
|
|
|
03-03-2008, 01:02 AM
|
#7
|
LQ Newbie
Registered: Aug 2007
Posts: 1
Rep:
|
autologin
Thank you guys, this thread was very helpful.
What I enjoyed most is the "win32sux" password in the C code ... can't agree more!
|
|
|
03-26-2008, 02:19 PM
|
#8
|
Senior Member
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561
Rep:
|
Does it work with Ubuntu ?
Last edited by frenchn00b; 10-18-2009 at 01:23 AM.
|
|
|
12-09-2008, 09:53 PM
|
#9
|
LQ Newbie
Registered: Jun 2007
Distribution: Slackware
Posts: 21
Rep:
|
Is there any problem I didn't notice using a shell script instead of C? Seems to work for me:
/etc/inittab:
Code:
c1:1235:respawn:/sbin/agetty -l /path/to/autologin.sh -n 38400 tty1 linux
autologin.sh:
Code:
#!/bin/sh
exec /bin/login -f username
I'd use the above for good measure, but is it any better then just
/etc/inittab:
Code:
c1:1235:respawn:/bin/su - username
?
EDIT3: This is probably useless, since su starts a shell but doesn't open a tty port. Maybe a -c option can be added to start x or something.
EDIT: What's the difference between:
Code:
exec /bin/login -f username
and
Code:
exec /bin/login -- username #this is what agetty does by default
?
I didn't notice any difference: if one asks for password so does the other and vice-versa (according to /etc/login.defs NO_PASSWORD_CONSOLE item and presence of password).
Is the -f option related to pam? I don't have pam installed.
EDIT2: If someone finds it inconvenient that you can't logout without being immediately relogged in, you can use the action "once" instead of "respawn" in the inittab entry.
If you don't want the tty to become useless after logout you can use a "wait" entry for the autologin, followed by the default "respawn" entry, both at the end of inittab:
Code:
a1:1235:wait:/sbin/agetty -l /path/to/autologin.sh -n 38400 tty1 linux
c1:1235:respawn:/sbin/agetty 38400 tty1 linux
Last edited by -kc-; 12-15-2008 at 11:35 AM.
|
|
|
05-21-2013, 10:53 AM
|
#10
|
Member
Registered: Jan 2013
Location: bangalore,india
Distribution: Ubuntu 12.4
Posts: 35
Rep: 
|
need help
followed same as above but iam using xinit. want to display window launcher on boot time using xinit with user account and having only one tty (tty1). disabled remaining ttys
if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
su -c "xinit ./myapp" <username>
fi
now my app wants to display at boot time without asking password in user account
|
|
|
07-06-2014, 04:32 PM
|
#11
|
Member
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 385
Rep:
|
does anyone knows why NO_PASSWORD_CONSOLE doesn't work on slackware 14.1?
|
|
|
07-06-2014, 06:47 PM
|
#12
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,700
|
you DO KNOW that this is a 9 year old post about Debian3
and NOT a slackware post
|
|
|
04-06-2016, 04:25 AM
|
#13
|
LQ Newbie
Registered: Sep 2009
Posts: 3
Rep:
|
Quote:
Originally Posted by FreakboY
does anyone knows why NO_PASSWORD_CONSOLE doesn't work on slackware 14.1?
|
just ignore it , it is working without it
|
|
|
04-09-2024, 06:13 AM
|
#14
|
LQ Newbie
Registered: May 2010
Distribution: OBsd, Slackware
Posts: 12
Rep:
|
Quote:
Originally Posted by homey
|
you may like to know the current url
https://linuxgazette.net/72/chung.html
|
|
|
All times are GMT -5. The time now is 09:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|