[SOLVED] CentOS 7 - Auto login on all terminals

General support questions
Post Reply
Locane
Posts: 25
Joined: 2014/09/05 00:40:12

[SOLVED] CentOS 7 - Auto login on all terminals

Post by Locane » 2014/09/05 00:44:36

Hello! I'm new to the forum and to linux in general, so I apologize if this has been asked already.

We deploy CentOS to a wide variety of machines for the purposes of stress testing. In my old CentOS 6.5 kickstart, I have a line to modify '/etc/init/tty.conf' to add the parameters "--autologin root" to any instance of "mingetty".

That file doesn't appear to exist in CentOS 7 - if I wanted to have all terminals automatically logged in to root, how would I accomplish that now?

Thanks in advance.
Last edited by Locane on 2014/09/12 00:44:56, edited 1 time in total.

lightman47
Posts: 1163
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: CentOS 7 - Auto login on all terminals

Post by lightman47 » 2014/09/05 12:35:08

root ??? AAAACK!!! What if you create a user (say maybe 'stress') and then have that account auto login?

Not sure it will work for you (I don't know CentOS7 - this is from similar Fedora)

Edit /etc/gdm/custom.conf and insert two lines into the [debug] section

AutomaticLoginEnable=true
AutomaticLogin=stress


Edit: This, of course, assumes you are using Gnome.
Remember - importing/building packages will likely "byte you in the butt" come update time, long after you'd forgotten you did that! Use repos whenever possible.

Locane
Posts: 25
Joined: 2014/09/05 00:40:12

Re: CentOS 7 - Auto login on all terminals

Post by Locane » 2014/09/05 15:59:28

Thanks for the reply.

We're using CLI only CentOS... no desktop GUI. I found the same information about gdm, but obviously that's not going to work.

Does anyone know where the tty config files should be placed if they don't exist already...?

rmikio
Posts: 1
Joined: 2014/09/10 19:11:31

Re: CentOS 7 - Auto login on all terminals

Post by rmikio » 2014/09/10 19:13:52

This is the recipe for autologin. The tip came from Fedora 20 forum:

http://forums.fedoraforum.org/showthread.php?t=297228

1. remove the original getty@tty1.service symlink:

Code: Select all

# rm /etc/systemd/system/getty.target.wants/getty@tty1.service
2. make a copy of the getty@.service file and call it getty@tty1.service

Code: Select all

# cp /lib/systemd/system/getty@.service /etc/systemd/system/getty@tty1.service
3. edit this file (the last line, must be ADDED):

Code: Select all

[Service]
...
ExecStart=-/sbin/agetty --autologin root --noclear %I
...
[Install]
...
;Alias=getty@tty1.service
4. make a symlink in getty.target.wants

Code: Select all

# ln -s /etc/systemd/system/getty@tty1.service /etc/systemd/system/getty.target.wants/getty@tty1.service
5. Reboot. It everything went fine you will be logged in as root.

Locane
Posts: 25
Joined: 2014/09/05 00:40:12

Re: CentOS 7 - Auto login on all terminals

Post by Locane » 2014/09/12 00:44:20

This worked perfectly!

Thank you so much Rmikio!

Post Reply

Return to “CentOS 7 - General Support”