public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Largret <largret@gmail.com>
To: David Fierbaugh <david@fierbaugh.org>
Cc: linux-newbie <linux-newbie@vger.kernel.org>
Subject: Re: chmod u+s confusion
Date: Mon, 10 Apr 2006 23:28:08 -0700	[thread overview]
Message-ID: <1144736888.9394.56.camel@localhost> (raw)
In-Reply-To: <200604071548.09870.david@fierbaugh.org>

On Fri, 2006-04-07 at 15:48 +0000, David Fierbaugh wrote:
> I would look at permissions of the folder you're trying to create the file in. 
> That seems like the likely candidate.
> 
> Can your script append to a file if it already exists? Should be a small 
> change to the code to do this, and might help diagnose the problem.

Found the answer on linuxsecurity.com
(http://www.linuxsecurity.com/content/view/119415/49/)

Any program that is set to run with the same privileges as its user can
be a huge security hole, so the kernel programmers have set out to
alleviate this threat a little. From my own tests, it appears to be
impossible to run a shell script (or any program through a system()
call) except as the user who is running the program/script. Any commands
processed by a prompt have their privileges downgraded to the executing
user.

I had tried my suid test with SH and Perl scripts as well as with a
quick C program. The Perl script and C program both used a system() call
to run "whoami" (in order to verify if the UID had changed due to the
use of SUID). The use of the system() call was forced to run as the
standard user, which gave the appearance of failure. It wasn't one.

The verdict: Use a compiled program and do things the right way if you
want to set the SUID bit. Avoid system() calls (even if they are only as
a test).

--
Chris Largret <http://daga.dyndns.org>

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  parent reply	other threads:[~2006-04-11  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-07  9:41 chmod u+s confusion Chris Largret
2006-04-07  8:42 ` David Fierbaugh
2006-04-07 18:06   ` Chris Largret
     [not found]     ` <200604071548.09870.david@fierbaugh.org>
2006-04-11  6:28       ` Chris Largret [this message]
2006-04-24 13:48 ` Kari Hurtta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1144736888.9394.56.camel@localhost \
    --to=largret@gmail.com \
    --cc=david@fierbaugh.org \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox