LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-21-2015, 01:04 PM   #1
pavan540
LQ Newbie
 
Registered: Sep 2015
Posts: 1

Rep: Reputation: Disabled
Unhappy mapping of uid and user


i am trying to get the owner (name) of a file using stat() system call. But i am geting uid (uid_t) which is an integer value. How to get the username from that integer??
 
Old 09-21-2015, 01:43 PM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Try %U:
Code:
$ stat --format "%U" ls_uniq.sh 
HMW
Code:
man stat
Best regards,
HMW

Last edited by HMW; 09-21-2015 at 01:44 PM.
 
Old 09-21-2015, 02:16 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Assuming you're talking about a C program, you can try getpwuid(3) to find a user name given a uid.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFSv4 uid mapping deu Slackware 1 10-18-2014 06:33 PM
Samba : Mapping User home direcories, and forcing UID's and GID's Nerdio Linux - Server 2 10-20-2011 02:56 AM
cifs uid mapping. cyent Linux - Networking 1 02-22-2006 06:37 PM
What is UID mapping? darai Linux - Newbie 2 06-22-2004 11:53 AM
UID Mapping for NFS without NIS jgombos Linux - Networking 1 07-27-2003 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration