The OS uses SSSD to authenticate users via LDAP. It has no X server running. I can run id <username>
to get the uid of the user. And the users can login to the system and their full name is displayed.
Is there a way to get the full name or display name of a specified user via a shell command?
getent passwd <username>
should do the trick.Try
(or other methods like
getent passwd <username>
).sssd 1.13+ provides a D-BUS query interface.
See also: sssd -- D-Bus Interface: Users and Groups
Depending on your UNIX version you can use
or
If both $LOGNAME and $USER are present they should match.