In this article we will see how to find the UID (User Identifier) and GID (Group Identifier) of a user of a Debian, Ubuntu or CentOS Linux system.

User ID

A UID is a user ID, a number assigned by Linux to each user on the system. This number allows the system to identify the user. UIDs are stored in the directory /etc/passwd.

Group ID

A Linux user also has groups, identifiable by their GID. Groups are stored in the file /etc/groups :

Find the UID and GID of a user

To find your own UID or GID, enter the command:

id

The command will return a result like this, with the UID and GID:

uid=0(root) gid=0(root) groupes=0(root)

To find the credentials of a user other than yourself, you must specify the user's name as the first argument to the command.

id root