Home > Operation and Maintenance > Linux Operation and Maintenance > How to check user's UID and GID in Linux

How to check user's UID and GID in Linux

藏色散人
Release: 2023-03-13 09:20:43
Original
7747 people have browsed it

How to check the user's UID and GID in Linux: 1. Determine your own uid and gid by checking the "/etc/passwd" file, and check the command such as "cat /etc/passwd | grep xxx"; 2 , just check the current user's ID directly through the ID command.

How to check user's UID and GID in Linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

How to check the user's UID and GID in Linux?

linux View the user's uid and gid

##1 .You can determine your uid and gid by looking at the /etc/passwd file


cat /etc/passwd | grep your username

Example:


aaa@aaa:~/Desktop$ cat /etc/passwd |grep aaa aaa:X:1000:1000:aaa,:/home/aaa:/bin/bash
The two characters after x The numbers are uid and gid. Here uid is 1000 and gid is also 1000

2. You can directly use the id command

(1) View the current user’s id

id

Result:


aaa@aaa:~/Desktop a$ id

uid=1000(aaa) gid=1000(aaa) group=1000(aaa )

(2) View the ids of other users


id Username

Example: View all ids of the root user

aaa@aaa:~/Desktop$ id root uid=0(root) gid=0(root) group=0(root)

Related recommendations: "

Linux video tutorial

The above is the detailed content of How to check user's UID and GID in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template