3

I am running a CentOS 7 virtual machine on my laptop and I'm using KDE (version 4.14.8). That VM serves as an Ansible control tower, from which my Ansible descriptions are applied to the other (headless) VMs that I use on the same laptop.

My problem is that the graphical login screen shows my account as well as the account ansible. I thought system accounts would not show up in that list so I created ansible as a system account. But here is an excerpt from my /etc/passwd file:

hg:x:1002:1002:Mercurial SCM:/home/hg:/bin/bash
saned:x:986:980:SANE scanner daemon user:/usr/share/sane:/sbin/nologin
backupscript:x:1003:1004:Data backup script:/home/backupscript:/sbin/nologin
ansible:x:985:979::/home/ansible:/bin/bash

As can be seen, hg is a user account, but it does not show up in the login screen, which means to me that the user account vs system account distinction is not the element that determines whether an account is shown in the login screen or not.

How can I hide an account on the login screen?

4
  • Is there a password defined for that ansible user?
    – xenoid
    Jul 20, 2019 at 19:23
  • Yes, there is indeed a password to that account.
    – AbVog
    Jul 21, 2019 at 5:07
  • Then remove it. With the proper setup you can su to it from you own account when needed.
    – xenoid
    Jul 21, 2019 at 8:23
  • Good idea, I hadn't though of that. But the account still shows up and clicking it logged me directly into a Gnome desktop.
    – AbVog
    Jul 21, 2019 at 9:48

3 Answers 3

2

In Kubuntu, you can add line HideUsers=ansible in /etc/sddm.conf.d/kde_settings.conf Under [Users] section.

Automated:

(
  username=ansible
  sudo mkdir -p /etc/sddm.conf.d
  echo "[Users]" | sudo tee /etc/sddm.conf.d/hide_${username}.conf
  echo "HideUsers=$username" | sudo tee -a /etc/sddm.conf.d/hide_${username}.conf
)

Hope this will be helpful.

2
  • Thanks but it's quite similar to the previous suggestion I had received. I have no 'sddm' file or folder in /etc/.
    – AbVog
    Jun 16, 2021 at 19:19
  • Works on fedora 36 kde Jan 24, 2023 at 14:38
1

To hide the user account, you can add HideUsers=ansible in /etc/sddm.conf under the [User] session.

2
  • I have done what you suggested, to no avail. The file did not exist and I created it. But the user still shows up on the account list from which I want to remove it. A yum list sddm reveals that sddm is not installed, which probably explains why the conf file is not taken into account.
    – AbVog
    Dec 26, 2019 at 17:07
  • I think you first need to find out what Desktop manager you are using. Those directives was for sddm, but it seems it is not the one your are currently using. You can see the content of /etc/X11/default-display-manager to find that. After that you have to search for appropriate configuration for that desktop manager. Dec 29, 2019 at 8:41
1

As of KDE 5, SDDM is the default login manager. Since you’re running KDE 4, I expect your system uses KDM instead. The KDM Handbook is no longer online, but the Wayback Machine has come to the rescue!

Chapter 4 says you can do what you need through System Settings → Login Manager, but it doesn’t give specifics:

Users

From here you can change the way users are represented in the login window.

Independently of the users you specify by name, you can use the System UIDs to specify a range of valid UIDs that are shown in the list. By default user id's under 1000, which are often system or daemon users, and user id's over 30000, are not shown.

Or Chapter 5 says you could edit kdmrc:

ShowUsers

This option controls which users will be shown in the user view (UserList) and/or offered for autocompletion (UserCompletion). If it is Selected, SelectedUsers contains the final list of users. If it is NotHidden, the initial user list contains all users found on the system. Users contained in HiddenUsers are removed from the list, just like all users with a UID greater than specified in MaxShowUID and users with a non-zero UID less than specified in MinShowUID. Items in SelectedUsers and HiddenUsers which are prefixed with @ represent all users in the user group named by that item. Finally, the user list will be sorted alphabetically, if SortUsers is enabled.

The default is “NotHidden”.

(A quick search suggests this file should be located at /etc/kde4/kdm/kdmrc.)


What’s interesting is that your /etc/passwd shows that ansible has a UID of 985… so it should already be hidden by default. Either of the above configuration options might let you see that this default has been overridden somehow.

If all else fails, you can manually change the user ansible to have some other UID and see if that fixes the problem.

First, find an unused UID. This command will list all the used ones:

$ awk -F: '$0=$3 "\t"$1' /etc/passwd | sort -g

Then, assuming you’ve found that 39001 is available, change the UID like so:

$ sudo usermod -u 39001 ansible

Note that any files that ansible owns will only have their ownership updated if they are in ansible’s home directory (/home/ansible according to your /etc/passwd). Anything else that ansible owns will need to be chown’d manually.

1
  • Thanks for this detailed and researched answer. I hope it'll be useful to others. I no longer have the issue, to my baffling, as I haven't done anything I can recall to successfully hide user Ansible. What's more, I just checked, and that user's UID is now… 1004. I have no existing kdmrc file.
    – AbVog
    Sep 15, 2021 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .