How to make all files uploaded through the Filemanager chmod to 700


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin

How to make all files uploaded through the Filemanager chmod to 700Last Modified: Apr 19, 2010, 12:40 am
To alter a file uploaded through the filemanager, create the script:

/usr/local/directadmin/scripts/custom/all_post.sh

In it, put:

#!/bin/sh

CHMODVAL=700
ULPATH=/home/${username}${path}

setfile() {
  if [ "$1" = "" ]; then
    return;
  fi

  F=`echo $1 | cut -d/ -f4 | awk '{ print substr($1,1,length($1)-6) }'`

  chmod ${CHMODVAL} ${ULPATH}${F}
}

TMP=/tmp/txt.txt
if [ "$command" = "/CMD_FILE_MANAGER/" ] || [ "$command" = "/CMD_FILE_MANAGER" ]; then
  if [ "$action" = "upload" ]; then

    setfile $file1
    setfile $file2
    setfile $file3
    setfile $file4
    setfile $file5
    setfile $file6
    setfile $file7
    setfile $file8
  fi
fi

exit 0;

Save, exit, and chmod the all_post.sh to 755.

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST