Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

st_uid/st_gid & username/groupname

Posted on 2006-06-06
5
Medium Priority
?
1,618 Views
Last Modified: 2012-06-27
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
Comment
Question by:tiger0516
  • 3
  • 2
5 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 200 total points
ID: 16848485
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
 
LVL 1

Author Comment

by:tiger0516
ID: 16848503
Which command?

Could u pls give me an example?

Tks
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 16848530
Hi tiger0516,

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

Kent
0
 
LVL 1

Author Comment

by:tiger0516
ID: 16848569
I know how to open/read a file. But then?

Thanks
0
 
LVL 1

Author Comment

by:tiger0516
ID: 16849151
Got it. I need to import pwd.h.

Thanks anyway.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question