123

How do I hide a particular user from the login screen on a default install of 11.10 and higher? (ie. using Unity Greeter)?

8 Answers 8

145

If your system uses AccountsService, you can not hide a user from the greeter screen by reconfiguring lightdm because it defers to AccountsService. That is stated very clearly in the comments in /etc/lightdm/users.conf.


What you need to do instead is to reconfigure AccountsService.

To hide a user named XXX, create a file named

/var/lib/AccountsService/users/XXX

containing two lines:

[User]
SystemAccount=true

If the file already exists, make sure you append the SystemAccount=true line to the [User] section.

The change takes effect after reloading AccountsService:

sudo systemctl restart accounts-daemon.service
11
  • 4
    works on vanilla 14.04 setup
    – frnhr
    Mar 15, 2015 at 10:21
  • 3
    Tested working on Ubuntu 16.04 too. Sep 11, 2017 at 23:45
  • 1
    This works also on Ubuntu 17.10 with Gnome 3
    – Schuh
    Mar 15, 2018 at 14:04
  • 9
    Also works on vanilla Ubuntu 20.04. Thank you!
    – loxo
    May 19, 2020 at 19:39
  • 2
    Btw, there is a standard lib crudini, which allows you to do so in scripting (less painful, more stable than sed or a blind >> append): crudini --set /var/lib/AccountsService/users/$_user User SystemAccount "true"
    – Frank N
    Dec 27, 2020 at 19:26
45
+100

Currently this method is not working because of a bug in lightdm.

Please check the bug status before applying this method.


Heres what you want to do:

First, make a backup of your config.

sudo cp /etc/lightdm/users.conf /etc/lightdm/users.conf.bak

Then, you need to edit your config:

sudo nano /etc/lightdm/users.conf

You'll see something like this:

#
# User accounts configuration
#
# NOTE: If you have AccountsService installed on your system, then LightDM will
# use this instead and these settings will be ignored
#
# minimum-uid = Minimum UID required to be shown in greeter
# hidden-users = Users that are not shown to the user
# hidden-shells = Shells that indicate a user cannot login
#
[UserAccounts]
minimum-uid=500
hidden-users=nobody nobody4 noaccess
hidden-shells=/bin/false /usr/sbin/nologin

Of interest to us is the part here:

hidden-users=nobody nobody4 noaccess

To hide the username james, just add it like this:

hidden-users=nobody nobody4 noaccess james

Then, reboot your computer and it should be gone.

As a reference to others, see

See https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/857651

On some versions of lighdm (Ubuntu 14.04) you need to rename [UserAccounts] to [UserList] (in /etc/lightdm/users.conf) for this method to work. (If you're interested in why this may be necessary, see common/user-list.c:321 from lightdm source.)

6
  • Does not work on 14.04 anymore but answer askubuntu.com/a/575390/7304 from @marc-culler below works.
    – laurent
    Mar 31, 2015 at 9:15
  • Still not fixed after six years, sigh :( Dec 1, 2017 at 16:29
  • @Bulletmagnet well Ubuntu isn't using lightdm anymore :(
    – jrg
    Dec 1, 2017 at 20:25
  • Whatever it's using, the problem persists :( Dec 2, 2017 at 10:31
  • It worked for me on Gentoo till these days when I installed AccountsService. Now the accepted answer work for me.
    – eNca
    Jul 1, 2020 at 5:04
17

Your option until bug 857651 is fixed is to create the user with uid < 1000

For example, to assign new uid less than 1000, (we are using 999) use this command

sudo usermod -u 999 user-name

Replace the user-name with the actual user name, just as anwar or detly etc.

4
  • 3
    This hides the user, but if you're changing the uid you may also want to change the gid, since they are usually the same number: sudo groupmod -g999 user-name. And as dqvn2002 mentions in their answer, for Ubuntu 12.04 you'll need a number < 500, so 999 won't work.
    – Lambart
    Feb 7, 2014 at 1:21
  • 3
    And don't forget! When you change the user id, any private files owned by that user will suddenly become inaccessible. You'll need to run (e.g.) sudo chown -R user-name:user-name /home/user-name.
    – Lambart
    Feb 7, 2014 at 1:23
  • On ubuntu 20.04, and landed here because an intended system account with uid/gid 998/996 at creation got added to the login screen. AccountsService actually also seems to explicitely opts out (with the accepted answer) user gdm with uid/gid 125/130 . TBH I had the same view than you, but it is not (anymore?) working at least on Ubuntu 20.04. Probable explanation is that /etc/lightdm/users.conf got actually set with minimum-uid=500.
    – vaab
    Mar 29, 2021 at 7:18
  • cat /etc/passwd|grep 999 can check if the user id isn't taken (i'm not sure if it matters, and yes it can show user names that contain the id so it's not perfect)
    – mekb
    Jun 19, 2021 at 9:52
10

because the Ubuntu 12.04 setup

[UserAccounts]  
minimum-uid=500

so we need to reduce the uid less than 500

example: sudo usermod -u 499 user-name

It works with me! SOLVED Good luck.

1
  • You may want/need to also change the group id, and chown any files owned by the user, as I commented on OerHeks' answer.
    – Lambart
    Feb 7, 2014 at 1:25
4

This method is not works on Ubuntu 13.10.

To hide user login names correctly You must to open LightDM config:

sudo vim /etc/lightdm/lightdm.conf

and add the following options:

greeter-hide-users=true
greeter-show-manual-login=true

Then save and reboot. That's all.

1
  • 2
    The accepted method is still not working on 14.04 and showing the manual login seems to me the best option too. In 14.04 add the lines listed in this answer to /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf .. if you want also to disable the guest user then append allow-guest=false Apr 18, 2014 at 22:34
1

This a variation of James' answer. You can hide users in lightDM by simply assigning them an ID below the minimum ID found in:

/etc/lightdm/users.conf

On my PC it was 1000

# minimum-uid = Minimum UID required to be shown in greeter
# hidden-users = Users that are not shown to the user
# hidden-shells = Shells that indicate a user cannot login
#
[UserAccounts]
minimum-uid=1000

You can change UID easilly in terminal:

sudo usermod -u PutUserNameHere

It works on my PC (in 2016), so I guess the lightDM bug that Eliah Kagan mentioned in 2014 with regards James' answer has been resolved.

1

In Ubuntu:

printf "[User]\nSystemAccount=true\n" | sudo tee /var/lib/AccountsService/users/libvirt-qemu
sudo systemctl restart accounts-daemon.service 
0

I just got this done using Login Manager Settings, a nice little graphical app which can be installed in a matter of seconds with flatpak:

flatpak install https://dl.flathub.org/repo/appstream/io.github.realmazharhussain.GdmSettings.flatpakref

Ok, it doesn't support hiding specific users (it will just hide all of them requiring everyone to type their username) but honestly I don't even think about complaining considering how quick and comfortable the process was.

That said, the same article where I found about the above app, also describes two other more conventional approaches, which are reported to work fine with latest Ubuntu releases (the article is just one month old).

  • Option 1: Create configuration file to disable user list
  • Option 2: Disable user list via settings command

Read more about them at https://fostips.com/hide-user-list-gdm-login-screen-ubuntu-20-04-20-10/

You must log in to answer this question.

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