• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1634
  • Last Modified:

st_uid/st_gid & username/groupname

Hi folks,

I know how to get st_uid and st_gid. But st_uid and st_gid are numbers. How can get owner's name and group's name provided I already know corresponding st_uid and st_gid ?

Pls tell me which command I shall use and I will then check man page.

Thanks
0
tiger0516
Asked:
tiger0516
  • 3
  • 2
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi tiger0516,

You'll have to read/parse the /etc/passwd and /etc/groups files to get the IDs associated with the two values.


Good Luck!
Kent
0
 
tiger0516Author Commented:
Which command?

Could u pls give me an example?

Tks
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi tiger0516,

You'll have to open the files and read them.

Kent
0
 
tiger0516Author Commented:
I know how to open/read a file. But then?

Thanks
0
 
tiger0516Author Commented:
Got it. I need to import pwd.h.

Thanks anyway.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now