You are not logged in.

#1 2011-10-19 00:28:40

sarloth
Member
Registered: 2011-02-22
Posts: 4

Permissions Confusion

I have created a very small page which simply posts a url to a text file. This works fine when I "chmod 777" the file. However, when I use "chmod 775" no text is written to the file. The "http" user owns the file. Another, likely related, issue is my normal user is part of the "http" group and is unable to modify this file.

<?php

$url = $_POST['url'];
if($url){exec("echo $url >> todo");}
?>
<form method="post" action="">
gimme dat url: <input type="text" name="url"><br>
<input type="submit" value="gogogo">
</form>

This is the output of ls -l for the directory:

drwxr-xr-x 2 http http 4096 Oct 18 23:21 chunes
-rw-r--r-- 1 http http  195 Oct 18 23:20 index.php
-rwxrwxr-x 1 http http    0 Oct 18 23:50 todo

Realizing this is probably something dumb, could someone help me through it?

Thanks!

Offline

#2 2011-10-19 01:21:47

sarloth
Member
Registered: 2011-02-22
Posts: 4

Re: Permissions Confusion

Alright, after trying again the form worked and successfully submitted the url to the text file. (no idea why it didn't before)

However, my user is still not able to modify the file:

[sarloth@minerva ~]$ touch /srv/http/snake/todo
touch: cannot touch `/srv/http/snake/todo': Permission denied

My username is listed in /etc/group:

http:x:33:sarloth

and of course, http:http still owns the file:

[sarloth@minerva ~]$ ls -l /srv/http/snake/
total 8
drwxr-xr-x 2 http http 4096 Oct 18 23:21 chunes
-rw-r--r-- 1 http http  195 Oct 18 23:20 index.php
-rwxrwxr-x 1 http http    0 Oct 19 01:07 todo

Offline

Board footer

Powered by FluxBB