batch chmod commands?

irma

Guppy
I wonder if I can make a script to change folder and file permissions using a script? Could I do it like this;

1. I create a script which includes chmod commands,
2. and copy it into cgi-bin folder (with .pl extention)?
3. I run it through the browser; like with awstats.pl?

Another question; is phpSuExec or suPhp running on the server?

Any help or link is appreciated, thank you very much.
 
I wonder if I can make a script to change folder and file permissions using a script? Could I do it like this;

1. I create a script which includes chmod commands,
2. and copy it into cgi-bin folder (with .pl extention)?
3. I run it through the browser; like with awstats.pl?

No. Unless root you can't get ownership back from httpd owned files.

Another question; is phpSuExec or suPhp running on the server?
No. I'm waiting for Hpshere support for fastcgi and will be going for it once made available.
 
No. Unless root you can't get ownership back from httpd owned files.
Dear Tanmaya, thanks for your reply, both here and "offtopic". I am aware that I cannot change file ownership which is run every 24 hours, thanks anyway for the clarification. Please let me rephrase the question;

As I understand it I would need phpSuExec or suPhp running on the server to avoid having to set file permissions to 777 for change in Joomla modules and addons. Whenever I change permissions to 777 I have a security issue, so it is important to change them back. I am looking for a way to handle the security issue more effective by running a script which I can use in several Joomla webs;

1. Can I make a script like this:

<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);

// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);

// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);

// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>

2. make a text file with .php extention
3. insert the file in a directory of the web
4. open the file in a web browser to execute it? Hm... I guess the current user to run the script must be the file owner... can I run it by using a cron job?

Thank you very much.
 
Or I can simply add ftp login info into php script like this;

function chmod_open()
{
// Use your own FTP info
$ftp_user_name = '[email protected]';
$ftp_user_pass = 'XXXXXXXXXX';
$ftp_root = '/';
$ftp_server = 'localhost';
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
return $conn_id;
}

.... and run script via browser?

Thanks again.
 
Just to add, this can be done from webshell or any FTP client as well (for Linux accounts only).
 
Back
Top