Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-06-2009, 11:42 PM   #1
Registered: Oct 2008
Posts: 51

Rep: Reputation: 15
C user function to check whether a given user has access permission to a file

Hi all,

Is there any C function in linux that help me to check whether a given user has a given permission on a file..

I tried access function , but it can only be used to check current users permission...

int access(const char *pathname, int mode)

Is there any function in which i can give a perticular user name or uid as one of the argument so than I can check for any users permission...
Old 10-07-2009, 12:05 AM   #2
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
You need to call stat on the file and check the st_mode bitmask. There are plenty of examples around.
Old 10-07-2009, 07:16 AM   #3
Registered: Oct 2008
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks crabboy...That does help


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
permission denied access mplayer for user poswer Linux - Server 1 03-07-2009 06:14 PM
CLI How to change folder access permission for particular user sfkong Linux - Newbie 10 07-20-2008 12:34 PM
User access permission to /dev/sg* shreks Fedora 1 01-16-2006 05:54 AM
permission problems: access Win as user digitalhead Slackware 19 07-24-2005 04:26 AM
user specific file access permission synna Linux - Security 3 01-13-2004 11:53 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:28 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
Open Source Consulting | Domain Registration