macOS: Hide users list when the screen is locked

By default, macOS shows a list of local users when you lock the screen, even if the boot login screen is set to name and password only (System Preferences → Lock Screen → Login window shows: Name and password). To hide the list of users and only show the currently logged in user, you can:

sudo defaults write /Library/Preferences/com.apple.loginwindow HideLocalUsers -bool TRUE

To revert, you can defaults delete the same value.