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


Closed Thread
  Search this Thread
Old 05-28-2007, 10:22 AM   #1
pampo
LQ Newbie
 
Registered: May 2007
Posts: 4

Rep: Reputation: 0
Question execl() fails with EACCES after setuid() call


Hello there,

myname is Matteo and I'm writing from Italy.

Maybe this is a very trivial issue but I'm going crazy on it.

I have a simple application, say test, owned by myuid.mygid, of course different from root, where myuid=31 mygid=31.

Inside it I just do:

...

res = setgid(31);
if (res != 0)
printf("setgid() failed\n");

res = setuid(31);
if (res != 0)
printf("setuid() failed\n");

res = execl("/usr/sbin/myapp", (char*) NULL);
printf("execl() returned %d\n", res);
if (res != 0)
printf("execl() error: %s (%d)\n", strerror(errno), errno);

...


Please note that myapp is owned by 0.mygid and is readable/executable by mygid and the same for /usr and /usr/sbin.

But execl() fails with EACCES.

It seems that setuid() is the real cause, because if I comment only it the result is OK.

Can anyone please tell me what's wrong?

Many many thanks,

Matteo.
 
Old 05-28-2007, 01:54 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
This seems to be a duplicate question. I've posted a response on the other copy of this question.
 
Old 05-28-2007, 05:39 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
I'm closing this thread, as it's a duplicate.
 
  


Closed Thread


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
execl question kev000 Programming 3 05-09-2007 08:17 AM
Help using popen and execl cdog Linux - Software 3 02-28-2007 06:44 PM
Sockets : Getaddrinfo call fails abrb220 Programming 2 06-06-2004 11:26 PM
Ioctl() call fails Custer Linux - Wireless Networking 0 02-16-2004 12:47 PM
Samba 2.2.7a fails to call add user script on Red Hat 9 DrFooMod2 Linux - Networking 4 07-17-2003 09:33 PM

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

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