LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-07-2009, 12:42 AM   #1
iamjayanth
Member
 
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...

Code:
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, 01:05 AM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

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

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


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration