Changes

Jump to navigation Jump to search
813 bytes added ,  10:33, 13 July 2018
no edit summary
Line 51: Line 51:  
  chmod 640 $(find /path/to/base/dir -type f)
 
  chmod 640 $(find /path/to/base/dir -type f)
 
  for fi in $(find /Pilaf -type f); do chmod 640 $fi;done  # if there are many files
 
  for fi in $(find /Pilaf -type f); do chmod 640 $fi;done  # if there are many files
 +
 +
== Chmod Script ==
 +
<nowiki>#!/bin/sh
 +
# syntax: setperm.s destdir
 +
#
 +
if [ -z $1 ] ; then echo "Requires single argument: <directoryname>" ; exit 1 ;                                      fi
 +
 +
destdir=$1
 +
 +
dirmode=0770
 +
filemode=0660
 +
 +
YN=no
 +
 +
printf "\nThis will RECURSIVELY change the permissions for this entire branch:\n                                      "
 +
printf "\t$destdir\n"
 +
printf "\tDirectories chmod = $dirmode\tFiles chmod = $filemode\n"
 +
printf "Are you sure want to do this [$YN]? "
 +
 +
read YN
 +
 +
case $YN in
 +
        [yY]|[yY][eE][sS])
 +
        # change permissions on files and directories.
 +
        find $destdir -type f -print0 | xargs -0 chmod $filemode $i
 +
        find $destdir -type d -print0 | xargs -0 chmod $dirmode $ii ;;
 +
 +
        *) echo "\nBetter safe than sorry I always say.\n" ;;
 +
esac</nowiki>

Navigation menu