Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-21-2015, 02:04 PM   #1
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, 02:43 PM   #2
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 757
Blog Entries: 3

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Try %U:
$ stat --format "%U" 
man stat
Best regards,

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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:33 PM
Samba : Mapping User home direcories, and forcing UID's and GID's Nerdio Linux - Server 2 10-20-2011 03:56 AM
cifs uid mapping. cyent Linux - Networking 1 02-22-2006 07:37 PM
What is UID mapping? darai Linux - Newbie 2 06-22-2004 12:53 PM
UID Mapping for NFS without NIS jgombos Linux - Networking 1 07-27-2003 07:52 PM

All times are GMT -5. The time now is 04:47 AM.

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