Re: chmod u+s confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux