LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-29-2006, 09:54 AM   #1
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Rep: Reputation: 24
acquire file access permissions in a program


I have been digging in manpages etc. for hours, and striking out.

I want to be able to read any file (after getting the root password from the user). In bash this is trivial, but I cannot figure out how to do this from a running C program.

1. ask user for root password
2. use password to set my running process to root user
(or otherwise be able to read any file)

thanks
 
Old 04-29-2006, 11:05 AM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 47
I'm not into C programming anymore, but you could just execute your program with `sudo`, given the appropriate configuration in /etc/sudoers. From a security point of view I'd think this is preferrable to getting the root password from the user.
 
  


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
file access/permissions rblampain Programming 2 01-18-2006 01:11 AM
fat32 file access permissions wwnexc Linux - Security 2 09-05-2005 11:04 PM
File access permissions gumbald Slackware 4 10-22-2004 09:23 PM
Permissions, File, Directory access tHcnunz Linux - Newbie 3 03-26-2004 10:25 AM
Samba file access permissions bryanl Linux - Networking 0 01-04-2004 06:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:05 PM.

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