Disable auto login on terminal server with command line or configuration file edit

Hi,

I work on a server using OpenSuse 12.3 installed with no GUI (no KDE, no Gnome, only terminal : it’s a server).
Auto login is enabled, and i want to disable it.

I surfed on search engines and forums, but everywhere the solution is to use graphical YaST2 interface, and i can’t.
I don’t have any /etc/sysconfig/displaymanager file to edit.

Do you know what command line to use, or what configuration file to edit ?
Thanks in advance,

Jacques

Hello Jacques and welcome to openSUSE! :slight_smile:

You can use yast on the command line, too.

You have to take


su -
yast

and you are in YaST in bash.

You can ask me and the others for other questions again.
Good luck!

Sarah

For the second queston:
You don’t need YaST to disable auto login.
Change to root and open the file /etc/sysconfig/displaymanager.

Commands:


su -
vi /etc/sysconfig/displaymanager

You have to look after DISPLAYMANAGER_AUTOLOGIN. That has to be empty.


[esc]
/DISPLAYMANAGER_AUTOLOGIN

When it is correct what the OP says, that he uses no GUI at all, there is no
displaymanager either. Thus configuring something there is of no use (most probably /etc/sysconfig/displaymanager does not even exist) .

Hi Sarah,

Thanks for all !
Unfortunately, in YaST2 ncurses mode, i only have these items in the menu :

Software
Hardware
System
Network services
Support
Miscellaneous

No user management here.

Jacques

I agree with Henk. That’s the issue.
Jacques

Install the package “yast2-users”.

That said, I didn’t know you can configure auto-login in text mode (i.e. without a display manager)…:\

And even the documentationonly mentions this:

10.3.1. Automatic Login and Passwordless Login

      If you use the KDE or GNOME desktop environment you can configure     *Auto Login* for a certain user as well as     *Passwordless Login* for all users. Auto login causes     a user to become automatically logged in to the desktop environment on     boot. This functionality can only be activated for one user at a time.     Login without password allows all users to log in to the system after     they have entered their username in the login manager.    

So how did you configure it in the first place? It definitely wasn’t enabled out of the box.

On 2013-11-09 15:16, jdesodt wrote:

> Unfortunately, in YaST2 ncurses mode, i only have these items in the
> menu :
>
>
> Code:
> --------------------
> Software
> Hardware
> System
> Network services
> Support
> Miscellaneous
> --------------------
>
>
> No user management here.

Install it.


YaST2 - menu @ Telcontar.valinor

┌───────────────────────────────────────────────────────────────┐
│                      YaST Control Center                      │
└───────────────────────────────────────────────────────────────┘

┌─────────────────┐ ┌───────────────────────────────────────────┐
│Software         │ │AppArmor Configuration                     │
│Hardware         │ │CA Management                              │
│System           │ │Common Server Certificate                  │
│Network Devices  │ │Firewall                                   │
│Network Services │ │Security Center and Hardening              │
│Security and User│ │Sudo                                       │
│Virtualization   │ │User and Group Management                  │
│Support          │ │                                           │
│Miscellaneous    │ │                                           │
│                 │ │                                           │
│                 │ │                                           │
└├──────────────┤─┘ └───────────────────────────────────────────┘

[Help]                                                      [Quit]


F1 Help  F9 Quit

You are missing many yast modules. You probably installed the minimal
pattern; IMNSHO, the minimal pattern is too minimal, I install instead
the minimal X pattern (even when X is not needed).


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

The package “yast2-users” is now installed, i can see “Security and Users” > “User and Group Management” > “Expert Options”
As you said, i can’t configure auto-login here, the only valid options are “Password Encryption” and “Write Changes Now”…

In the first place i created a suse studio appliance with Server base template.
During appliance creation, in the configuration tab there is a checkbox “Automatically log in user”, and -what a pity- it has been checked.

On 2013-11-09 15:36, wolfi323 wrote:
> So how did you configure it in the first place? It definitely wasn’t
> enabled out of the box.

IIRC, autologin is the default. I have to untick it during installation.
However, I fail to see how it can affect a text only system :-?


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Well, by googling I found this: auto login as root (or other user) in console mode

Since on 12.3 systemd is used, the second part with the inittab doesn’t apply anymore. That --autologin has to be specified somewhere else I guess (some systemd unit). Maybe grep for “autologin” in /etc/systemd and /usr/lib/systemd?
But removing that “NO_PASSWORD_CONSOLE” line from /etc/login.defs should at least prevent the automatic login, provided that’s there in the first place of course.

Found that as well now, maybe that helps you:
Auto-Login without a Graphical Desktop Manager & with Systemd - Manjaro Linux

I will have a look at SUSE studio and that “server based template”, maybe I can find out more.

OK, after having a look at the /etc/init.d/suse_studio_firstboot file, I think you have to do this to disable auto-login:


rm /etc/systemd/system/getty@tty1.service
systemctl disable autologin@tty1
systemctl enable getty@tty1

And maybe even remove /etc/systemd/system/autologin@.service …

But I cannot test this right now, so no guarantees! :wink:

PS: For reference, suse_studio_firstboot does this on first boot:

# enable console autologin for systemd distributions
enable_autologin_if_required() {
  if  -e /etc/systemd/system/autologin@.service ]; then
    systemctl disable getty@tty1
    systemctl -f enable autologin@tty1
    # workaround for the fix of bnc#804158 (check bnc#807289 for further details)
    ln -s /etc/systemd/system/autologin@.service /etc/systemd/system/getty@tty1.service
    systemctl restart autologin@tty1
  fi
}

1 Like

Awesome, wolfi323 you got it ! I used your three command lines : it works perfectly.
No more autologin, thanks to you and to this great OpenSuse community
:slight_smile:

For the record Can you please explain what that autologin did do?

Do I understand it correctly that you had a text only installation and that after boot it loged in in the console autimaticaly without asking for any username (and password). And when yes, which user was used for that autologin. And again when yes, was this by default after the installation?

I ask, because I can hardly believe that I understand this as I outline above. Thus either I understand it wrongly, or there is something utterly wrong in the default text only installation.

Correct.

And when yes, which user was used for that autologin. And again when yes, was this by default after the installation?

When you create an appliance in SUSE studio you can configure it to have a certain user auto-login. You have to create a user for that though, you are not allowed to have “root” auto-login.

So this has nothing to do with a standard openSUSE text mode installation.

You already have the option:
Yast - System - Sysconfig editor
Search for “AUTOLOGIN”
Remove the user’s name.

But, I doubt that autologin works at all, since it’s not meant for the system, but for the desktop environment, i.e. X.
When booting a headless server autlogin doesn’t do anything IIRC.

That’s something completely different.

SUSE studio’s autologin feature creates an autologin@.service systemd unit (calls agetty with the -a option) and enables it instead of the standard getty.service.

And apparently this does work on a headless server, otherwise this thread wouldn’t exist! :wink:

1 Like

Auto-login is default for a graphical installation.
Auto-login in text mode is definitely not enabled out of the box, and isn’t even possible with simply editing configuration files in /etc/sysconfig/.
That’s why I asked.

Thanks, that is good to read. :slight_smile:

Am I correct that this misunderstanding is due to the fact that the OP nowhere tells he uses something different from a standard 12.3?

Henk, i agree. My apologies.