I am using LAMP Apache version 2.2.15 on CentOS 6.6.
I have created a directory /var/www/dropbox which has permissions rwxrwsr-x. I have made the group www-OtagoHarbour the owner where www-OtagoHarbour was created using
sudo groupadd www-OtagoHarbour
sudo usermod -G www-OtagoHarbour apache
sudo usermod -G www-OtagoHarbour OtagoHarbour
I have given apache ownership of the directory using
sudo chown apache /var/www/dropbox
and the group access using
sudo chgrp -R www-OtagoHarbour /var/www/dropbox
sudo chgrp -R www-OtagoHarbour /var/www
sudo chmod -R g+r /var/www/dropbox
sudo chmod -R g+r /var/www
I upload files to that folder using the following html call.
<form action="http://whatever.com/uploadFiles.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file[]" multiple="multiple"/></br>
<input type="submit" name="submit[]" value="submit" />
<input type="hidden" id="LoggedIn" name="LoggedIn" value="<?php echo $_SESSION['LoggedIn'] ?>">
<input type="hidden" id="setName" name="setName" value="<?php echo $setName ?>">
<input type="hidden" id="UserName" name="UserName" value="<?php echo $_SESSION['UserName'] ?>">
</form>
uploadFiles.php copies the uploaded files into /var/www/dropbox. Unfortunately, the permissions of the uploaded files are -rw-r--r-- whereas I would like them to be -rw-rw-r--. I tried
sudo find /var/www/dropbox -type d -exec chmod 2775 {} \;
and rebooted the computer but the uploaded files still have permission -rw-r--r--. I know I can change the permissions using
sudo chmod g+w fileName
but I would like this to be done automatically since I have code that processes the files and sends them elsewhere.
find
command.