Help - Search - Members - Calendar
Full Version: Auto Log In
Linuxhelp > Support > Technical Support
OK, don't freak out.

I want to know if there is a way to make linux (redhat 9.0) auto log in for a certain user. of course there would still have to be a way to break out of the auto log on if I needed to get in as root.

Basically what I am doing is make a system that boots up and automatically logs in as some user then starts up rdesktop and connects to my Terminal Server. I already have rdesktop working and as soon as my user logs in, rdesktop auto starts and connects to the terminal server, then the user logs into the network -- it works great. i'm just trying to get around the user having to log in twice.

I figured ya'll would know if this was possible or not.
I think this can be done using GDM.

I found this off google:

"Gnome menu -> Programs -> System -> GDM configurator

The GDM configuration tool will allow you to set GDM up to automatically
log a user in at startup. That user can still log out and log in as
another user (or CTRL+ALT+Backspace to log in again!)"
Thanks for the Tip, I'll look into it.

If anyone has any other information on GMD or anything else, I appreciate it
More info on it can be found at and
I don't think that GDM is going to work for me. I need to make this happen in console mode (command prompt only). Im working with older systems and have not installed Gnome or KDE. As a matter of fact the only things I install are Xwindows, and rdesktop, the less I install the better.

Maybe what I'm trying to do is not possible, does any one have any other thougts?
Try searching for "autologin linux console" or something similar.

I came across but dont have time right now to fully read through it.
Would it be possible to use rc.local?

any thoughts?
Another fellow is telling me:

you should be able to run a script as some user from rc.local that starts up X & rdesktop with 'su - username -c /path-to/startup-script'

What do you guys think of this?
No idea if it will work. Give it a shot and let us know.
I got it to work!! (kind of)

This is what I did:

For automatic login, you will need to create a user (and the home directory is required).
I will use guest.

Create a file (autologin) in /sbin
In the file, add:
exec su --login guest

Save it and make it executable:
chmod 755 autologin

In the /etc/inittab, replace the line
1:2345:respawn:/sbin/mingetty tty1
1:2345:respawn:/sbin/autologin tty1

You should set automatic login on tty1, since tty1 is where the guest login will default to.

OK, I did not use the guest account, instead I used a user that I have been working with on my system. It worked, my machine auto logged !! im stoked!

My problem now is that my user can not startx, he could before and root can still. I get an error that says "Pam authentication failed, can not start server. Perhaps you do not have console ownership"

what do you think?
well I would say it has to do with removing "mingetty tty1". After you log in, run ps aux and see who has ownership of the tty1.
I believe that you are correct, this must be the problem.

When I do a ps aux, mingetty tty1 does not show up. mingetty tty3, 4, 5 and 6 show up all owned by root.

When I put the inittab file back to the way it was, my user can startx normally.

my bubble has burst :-(
Have a look at
OK this is great, I think it going to work.

Just one quick question: (remember i'm a newbe)

There is a line in these instuctions that says "compile this tiny C program using the GNU C-compiler" Then goes on to give an example:

gcc -o autologonfred autologonfred.c

It does not seem that gcc is installed on my system, do I need to install it? Or is this example wrong, or does redhat use some other c compiler?

Thanks for all you help by the way.
You'll need to install gcc. Just grab the RPM from your redhat cds or from the redhat ftp site.
RIGHT ON!! That was it!

Thanks again Joey for all the help.

Just in case that link you provided stops working one day (I found this to be very common while searching for answers to this problem), i'm posting the directions so that if any one is looking to do this same thing can benefit from them.

HOW TO MAKE LINUX AUTO LOG ON to the console (command prompt):

Using your favourite text editor create a file named autologinfred.c and type in this short C program:

int main() {
execlp( "login", "login", "-f", "fred", 0);

The execlp system call invokes the command "login -f fred" and replaces the current processing context with this invocation. The man page for login describes the action of the -f argument. Compile this tiny C program using the GNU C-compiler:

$ gcc -o autologinfred autologinfred.c

Gain root privileges (using su) and copy the executable to a public directory:

# cp autologinfred /usr/local/sbin/

Now take a look at /etc/inittab. This is the configuration file is used by init, the very first process started when Linux initialises. You should observe lines similar to the following:

1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3

The exact contents of /etc/inittab differ from distribution to distribution. On Debian systems one sees:

1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3

Edit 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

The above will cause the user fred to be logged in automatically on the first virtual console. On some GNU/Linux distributions (like RedHat) /sbin/agetty must be used instead. The -l <alternative login> argument to getty substitutes the default /sbin/login program with the one we compiled earlier. The -n tells getty to not prompt for a user ID.

Good luck and thanks again!
Awesome smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.