LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 10-18-2005, 12:57 PM   #1
PFloyd2002
LQ Newbie
 
Registered: Aug 2005
Posts: 4

Rep: Reputation: 0
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!
 
Old 10-18-2005, 02:08 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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.
Old 11-04-2005, 03:34 AM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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.
Old 11-04-2005, 04:24 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I installed qlogin in a slackware box to autologin, it works well
(it requires a perl module : User::Utmp)

http://freshmeat.net/redir/qlogin/16...l_tgz/software
 
Old 11-04-2005, 06:04 AM   #5
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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):
Code:
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.
 
Old 02-06-2007, 12:03 AM   #6
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Rep: Reputation: 45
thanks guys, someone asked me how to do this and this thread helped. i wrote down all the steps i followed: http://littlesvr.ca/linux-stuff/arti...ginconsole.php

cheers
 
Old 03-03-2008, 01:02 AM   #7
NAEET
LQ Newbie
 
Registered: Aug 2007
Posts: 1

Rep: Reputation: 0
Thumbs up 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!
 
Old 03-26-2008, 02:19 PM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
Quote:
Here's some notes from an article at http://www.linuxgazette.com/issue72/chung.html

http://linuxgazette.net/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 autologi
Does it work with Ubuntu ?

Last edited by frenchn00b; 10-18-2009 at 01:23 AM.
 
Old 12-09-2008, 09:53 PM   #9
-kc-
LQ Newbie
 
Registered: Jun 2007
Distribution: Slackware
Posts: 21

Rep: Reputation: 15
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.
 
Old 05-21-2013, 10:53 AM   #10
ssanthshtech
Member
 
Registered: Jan 2013
Location: bangalore,india
Distribution: Ubuntu 12.4
Posts: 35

Rep: Reputation: Disabled
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
 
Old 07-06-2014, 04:32 PM   #11
FreakboY
Member
 
Registered: Jun 2002
Location: TX, USA
Distribution: Slackware
Posts: 385

Rep: Reputation: 32
does anyone knows why NO_PASSWORD_CONSOLE doesn't work on slackware 14.1?
 
Old 07-06-2014, 06:47 PM   #12
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,621

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
you DO KNOW that this is a 9 year old post about Debian3
and NOT a slackware post
 
Old 04-06-2016, 04:25 AM   #13
help40
LQ Newbie
 
Registered: Sep 2009
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by FreakboY View Post
does anyone knows why NO_PASSWORD_CONSOLE doesn't work on slackware 14.1?
just ignore it , it is working without it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
autologin after reboot nazir Linux - Newbie 3 08-08-2005 05:01 AM
autologin zaicheke Linux - General 1 07-16-2004 07:15 PM
Autologin with GUI, and shutdown gregorya Linux - Software 1 06-12-2004 07:18 AM
autologin on RH 7.2 mehesque Linux - General 0 06-08-2004 08:16 AM
Autologin to X as a user - how do I? unixgeek Linux - Software 9 08-29-2003 05:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration