* Question regardin deleting a file in /tmp directory
@ 2008-03-28 15:23 Mário Gamito
2008-03-28 15:51 ` Jose Celestino
2008-03-28 17:27 ` Adam Bowen
0 siblings, 2 replies; 3+ messages in thread
From: Mário Gamito @ 2008-03-28 15:23 UTC (permalink / raw)
To: linux-admin
Hi,
I have this PHP script (simplificated here), called delete_tmp.php
that basically calls external commands:
<?php
$session_file = '/tmp/sess_89765'
system(''rm -f' . ' ' . $session_file);
?>
delete_tmp.php file is owned by gamito.users
/tmp/sess_89765 file has permissions -rw------ and is owned by gamito.users
My /tmp permissions are rwxrwxrwt and is owned by root.root
I know that the the sticky bit only allows files to be deleted by
their owners, the owner of the directory or by root.
Never the less, i can switch to /tmp directory and delete sess_89765
file as user gamito.
If I run:
$ php delete_tmp.php
as root, it deletes sess_89765 file.
But if I do the same has user gamito, it doesn't delete the file !!!
Ideas ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regardin deleting a file in /tmp directory
2008-03-28 15:23 Question regardin deleting a file in /tmp directory Mário Gamito
@ 2008-03-28 15:51 ` Jose Celestino
2008-03-28 17:27 ` Adam Bowen
1 sibling, 0 replies; 3+ messages in thread
From: Jose Celestino @ 2008-03-28 15:51 UTC (permalink / raw)
To: Mário Gamito; +Cc: linux-admin
Words by Mário Gamito [Fri, Mar 28, 2008 at 03:23:37PM +0000]:
> Hi,
>
> I have this PHP script (simplificated here), called delete_tmp.php
> that basically calls external commands:
>
> <?php
>
> $session_file = '/tmp/sess_89765'
>
> system(''rm -f' . ' ' . $session_file);
>
> ?>
>
> delete_tmp.php file is owned by gamito.users
>
> /tmp/sess_89765 file has permissions -rw------ and is owned by gamito.users
>
> My /tmp permissions are rwxrwxrwt and is owned by root.root
>
> I know that the the sticky bit only allows files to be deleted by
> their owners, the owner of the directory or by root.
>
> Never the less, i can switch to /tmp directory and delete sess_89765
> file as user gamito.
>
> If I run:
> $ php delete_tmp.php
>
> as root, it deletes sess_89765 file.
>
> But if I do the same has user gamito, it doesn't delete the file !!!
>
> Ideas ?
>
Yes, remove the -f.
--
Jose Celestino
----------------------------------------------------------------
http://www.msversus.org/ ; http://techp.org/petition/show/1
http://www.vinc17.org/noswpat.en.html
----------------------------------------------------------------
"If you would have your slaves remain docile, teach them hymns."
-- Ed Weathers ("The Empty Box")
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question regardin deleting a file in /tmp directory
2008-03-28 15:23 Question regardin deleting a file in /tmp directory Mário Gamito
2008-03-28 15:51 ` Jose Celestino
@ 2008-03-28 17:27 ` Adam Bowen
1 sibling, 0 replies; 3+ messages in thread
From: Adam Bowen @ 2008-03-28 17:27 UTC (permalink / raw)
To: linux-admin
[-- Attachment #1: Type: text/plain, Size: 848 bytes --]
Hi,
Mário Gamito wrote:
> If I run:
> $ php delete_tmp.php
Is this the CGI or CLI version of php that you are running (php
--version)? (You can create a standalone version of both, I know, I
have the empty follicles to prove it). The CGI version has extra
restrictions that may cause weirdness. As a test I would try doing an
ls of the file before the rm and see what the output of that is.
Cheers
Adam
> as root, it deletes sess_89765 file.
>
> But if I do the same has user gamito, it doesn't delete the file !!!
>
> Ideas ?
>
> Any help would be appreciated.
>
> Warm Regards,
> Mário Gamito
> --
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-28 17:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 15:23 Question regardin deleting a file in /tmp directory Mário Gamito
2008-03-28 15:51 ` Jose Celestino
2008-03-28 17:27 ` Adam Bowen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).