For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > November 2005 > chmod help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author chmod help
Freebird

2005-11-10, 6:56 pm

Hello everyone, =]


I need your help,

I'm creating a script that will work in many servers, and there's this part,
where you can update a list, so the script goes from the client's machine to
the central server, opens the file, and in adda line by line in the client
server, it's all working fine, but there's a problem, this list, can't be
available to others, because if I do this:


www.test.com/list/test.txt

I can see the hole list, if I remove the permissions, my script wont work
anymore, what can I do ?

I've thought that I could chmod the file to 0777, make it a copy, and remove
the permission, so the file would't be available for others that just enter
the URL.
But it doesn't work at all, here's the error I get:


Warning: chmod(): Unable to access www.test.com/proxy/ in
/home/test/public_html/clicksentinel/form_classes.php on line 859

Warning: chmod(): No such file or directory in
/home/test/public_html/clicksentinel/form_classes.php on line 859
Sorry, try again later, error at data number5You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version for
the right syntax to use near 't have permission to access
/proxy/proxylist.txt')' at line 1


Please, I really need some help,

tks a lot

Freebird



vizo

2005-11-11, 6:56 pm

in face,your mutil server is the same to the hackers' browser,
they communicate via HTTP

what you should focus with is not chmod,
but how to tell the connection from client is from your other server,
or other users' browser.

i think this solution will work:
1.use a script to read the list
1.1.you put your text.txt in a safe path,which can not be accessed by
the internet.
1.2.create a php file to read text.txt to browser
1.3.you navigate to the php script to see if you can get what's in
text.txt

2.add a permission check
2.1 modify the php script , generate a password for it
it maybe like this:
if($serverID=="ocwjkfajd8jkslkcja9eu98uf"){
// disp text.txt conteset
}
else{
// tell error
}
2.2 modify your other server's script,when access the old text.txt,
visit the php script with password instead.
for
example,www.test.com/list/test.php?serverID...jkslkcja9eu98uf
2.3 others doesnot know the password will not receive the content of
text.txt
2.4 you may extend the script,for example,create a single password
for each server


hope help

Regards
vizo

Freebird wrote:
> Hello everyone, =]
>
>
> I need your help,
>
> I'm creating a script that will work in many servers, and there's this part,
> where you can update a list, so the script goes from the client's machine to
> the central server, opens the file, and in adda line by line in the client
> server, it's all working fine, but there's a problem, this list, can't be
> available to others, because if I do this:
>
>
> www.test.com/list/test.txt
>
> I can see the hole list, if I remove the permissions, my script wont work
> anymore, what can I do ?
>
> I've thought that I could chmod the file to 0777, make it a copy, and remove
> the permission, so the file would't be available for others that just enter
> the URL.
> But it doesn't work at all, here's the error I get:
>
>
> Warning: chmod(): Unable to access www.test.com/proxy/ in
> /home/test/public_html/clicksentinel/form_classes.php on line 859
>
> Warning: chmod(): No such file or directory in
> /home/test/public_html/clicksentinel/form_classes.php on line 859
> Sorry, try again later, error at data number5You have an error in your SQL
> syntax. Check the manual that corresponds to your MySQL server version for
> the right syntax to use near 't have permission to access
> /proxy/proxylist.txt')' at line 1
>
>
> Please, I really need some help,
>
> tks a lot
>
> Freebird
>
>
>

Meião

2005-11-14, 9:55 pm

you may put the list.txt in someplace not accessible to you webserver
(if you own the server), like /var/list.txt

or you can block access with .htaccess (in apache, is the name right?
..htaccess?)

Freebird

2005-11-20, 3:55 am

the problem is that the file is going to be accesse from another server, in
fact, a lot of servers.
That's why it's not possible to do that..

ANy other suggestions ?

tks a lot anyway


Freebird


Connector5

2005-11-20, 7:55 am

If the servers are connected to the same LAN, then you can use remote
mounting: http://opensource.weblogsinc.com/en...34000507065907/

If all the servers are running SSH daemons, use the php SSH tools:
http://us2.php.net/ref.ssh2

Alternatively, you can use shell_exec in php to run something like: "scp
server.domain.top:/path/to/file ." from each machine to obtain the file and:
"scp ./file server.domain.top:/path/to/" to upload.

If you can use apache basic authentication, then you can htpasswd the
script:
http://www.higherpass.com/php/tutor...mote-Servers/5/





"Freebird" <peoplel@hotmail.com> wrote in message
news:dlp8nf$86a$1@domitilla.aioe.org...
> the problem is that the file is going to be accesse from another server,

in
> fact, a lot of servers.
> That's why it's not possible to do that..
>
> ANy other suggestions ?
>
> tks a lot anyway
>
>
> Freebird
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com