LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-23-2008, 10:52 AM   #16
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30

I'm thinking about just rewriting the second script as a C program. Then then SUID bit should actually function.

Is there anyway to call a linux shell command (like cp for copying) from a C program? That would make life easier.

hmm "system()" function. I'll look it up.

EDIT:

Rewrite the script... I'm just going to make a tiny wrapper program to call the script for me... actually I just finished making it. Now to test...

Last edited by davidstvz; 08-23-2008 at 12:15 PM.
 
Old 08-23-2008, 12:38 PM   #17
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
I just wrote a test program ( while(true); ) and set the suid bit and the owner, but when the unprivileged user runs the program, it does not pay any attention to the suid bit as far as I can tell.


I don't know what I could have done wrong. Here are the permissions:

-rwsr-xr-x 1 privuser group 10385 2008-08-23 11:27 a.out


Here is the call from the regular user:

~privuser/bin/a.out


Here is what ps -aux reports:

privuser 32637 113 0.0 6900 840 pts/4 R+ 11:37 0:03 /home/privuser/bin/a.out

EDIT

I think I got it! The default fstab option for suid vs. nosuid in suse is apparently nosuid. So I explicitly set it to suid and it appears to have finally started working right.

Now to test the actual functionality.

EDIT2:

And it does NOTHING (*#$)(*#@

:face_mad:

PS shows the user ID for the privileged user, but when the program tries to even access the shellscript (which I now have set to rwx------ so that only the privuser can run it) the rws program won't even access it.

Makes no sense...

Is there a special way to invoke suid?

Last edited by davidstvz; 08-23-2008 at 12:55 PM.
 
Old 08-23-2008, 01:27 PM   #18
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
Is it possible that when I make the system() call from the suid program, it loses suid privileges and reverts back to the user's privileges?
 
Old 08-23-2008, 02:33 PM   #19
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 30
*sigh*

That's exactly what's happening. I've verified that the suid wrapper I wrote is running properly (it can write files and everything, though so far it won't create directories though I am just using ofstream myfile; myfile.open()).

It will only make a new file in a directory that already exists and has --x privileges set for group. weird.
 
  


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
permissions question fluidicslave Linux - Security 4 07-23-2006 09:52 PM
permissions question sunman Slackware 7 11-18-2005 11:00 PM
Permissions question: what does the Thaidog Linux - General 7 03-29-2005 11:16 PM
Permissions question gauge73 Linux - Newbie 4 05-02-2003 05:33 PM
permissions question cinnix Linux - General 2 07-09-2001 08:59 AM


All times are GMT -5. The time now is 11:02 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