This file is indexed.

/usr/share/gridengine/util/setfileperm.sh is in gridengine-common 8.1.9+dfsg-7build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#!/bin/sh
#
# Set file permissions of Grid Engine distribution
#
#___INFO__MARK_BEGIN__
##########################################################################
#
#  The Contents of this file are made available subject to the terms of
#  the Sun Industry Standards Source License Version 1.2
#
#  Sun Microsystems Inc., March, 2001
#
#
#  Sun Industry Standards Source License Version 1.2
#  =================================================
#  The contents of this file are subject to the Sun Industry Standards
#  Source License Version 1.2 (the "License"); You may not use this file
#  except in compliance with the License. You may obtain a copy of the
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
#  Software provided under this License is provided on an "AS IS" basis,
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
#  See the License for the specific provisions governing your rights and
#  obligations concerning the Software.
#
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
#  Copyright: 2001 by Sun Microsystems, Inc.
#
#  All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
#
#
# The $OPTFILES are not mandatory for a distribution and will be set only if
# they exist
#
# This script must be called by user root on a machine where user root has
# permissions to change the ownership of a file
# 
# It is not necessary to run this script if the distribution has been
# installed with a package manager that takes care about the correct
# permissions.
#

PATH=/bin:/usr/bin:/usr/sbin

FILELIST="bin examples inst_sge install_execd install_qmaster \
          lib mpi pvm util utilbin"

OPTFILES="catman ckpt doc include man hadoop dtrace qmon start_gui_installer"

SUIDFILES="utilbin/*/rsh utilbin/*/rlogin utilbin/*/testsuidroot bin/*/sgepasswd utilbin/*/authuser"

umask 022

#---------------------------------------------------
# SetFilePerm
#
SetFilePerm()
{
   f="$1"
   user="0"
   group="0"

   $ECHO "Verifying and setting file permissions and owner in >$f<"

   chmod -R go+r $f
   find $f -type d -exec chmod 755 {} \;
   find $f -type f -perm -100 -exec chmod go+x {} \;
   chown -R $user $f
   chgrp -R $group $f
}

#---------------------------------------------------------------------
# MAIN MAIN
#

instauto=false

if [ -z "$SGE_ROOT" -o ! -d "$SGE_ROOT" ]; then
   echo 
   echo ERROR: Please set your \$SGE_ROOT environment variable
   echo and start this script again. Exit.
   echo 
   exit 1
fi

if [ ! -f "$SGE_ROOT/util/arch" ]; then
   echo 
   echo ERROR: The shell script \"$SGE_ROOT/util/arch\" does not exist.
   echo Please verify your distribution and restart this script. Exit.
   echo
   exit 1
fi

if [ ! -f $SGE_ROOT/util/arch_variables ]; then
   echo
   echo ERROR: Missing shell script \"$SGE_ROOT/util/arch_variables\".
   echo Please verify your distribution and restart this script. Exit.
   echo
   exit 1
fi

. $SGE_ROOT/util/arch_variables

if [ $ARCH = "win32-x86" ]; then
   echo
   echo "ERROR: Using this script on windows is not supported!"
   echo "Please execute this script on a unix host"
   echo
   exit 1
fi

if [ $# -lt 1 ]; then
   echo
   echo Set file permissions and owner of Grid Engine distribution in \$SGE_ROOT
   echo 
   echo "usage: $0 [-auto] <sge_root>"
   echo 
   echo example: $0 \$SGE_ROOT
   echo
   exit 1
fi

if [ $1 = -auto ]; then
   instauto=true
   shift
fi

if [ $1 = / -o $1 = /etc ]; then
   echo
   echo ERROR: cannot set permissions in \"$1\" directory of your system.
   echo
   exit 1
fi

if [ `echo $1 | env LC_ALL=C cut -c1` != / ]; then
   echo
   echo ERROR: Please give an absolute path for the distribution.
   echo
   exit 1
fi


if [ $instauto = true ]; then
   :
else
   clear
   $ECHO "                    WARNING WARNING WARNING"
   $ECHO "                    -----------------------"
   $ECHO "We will set the the file ownership and permission to"
   $ECHO
   $ECHO "   UserID:         0"
   $ECHO "   GroupID:        0"
   $ECHO "   In directory:   $1"
   $ECHO
   $ECHO "We will also install the following binaries as SUID-root:"
   $ECHO
   $ECHO "   \$SGE_ROOT/utilbin/<arch>/rlogin"
   $ECHO "   \$SGE_ROOT/utilbin/<arch>/rsh"
   $ECHO "   \$SGE_ROOT/utilbin/<arch>/testsuidroot"
   $ECHO "   \$SGE_ROOT/bin/<arch>/sgepasswd"
   $ECHO "   \$SGE_ROOT/bin/<arch>/authuser"
   $ECHO

   TEXT="Do you want to set the file permissions (yes/no) [NO] >> \c"

   YesNo_done=false
   while [ $YesNo_done = false ]; do
      $ECHO "$TEXT" 
      read YesNo_INP
      if [ "$YesNo_INP" = "yes" -o "$YesNo_INP" = YES ]; then
         YesNo_done=true
      elif [ "$YesNo_INP" = "NO" -o "$YesNo_INP" = no ]; then
         $ECHO
         $ECHO "We will NOT set the file permissions. Exiting."
         exit 1
      fi
   done
fi

cd $1
if [ $? != 0 ]; then
   $ECHO "ERROR: can't change to directory \"$1\". Exiting."
   exit 1
fi

for f in $FILELIST; do
   if [ ! -f $f -a ! -d $f ]; then
      $ECHO
      $ECHO "Obviously this is not a complete Grid Engine distribution or this"
      $ECHO "is not your \$SGE_ROOT directory."
      $ECHO
      $ECHO "Missing file or directory: $f"
      $ECHO
      $ECHO "Your file permissions will not be set. Exit."
      $ECHO
      exit 1
   fi
done

for f in $FILELIST $OPTFILES; do
   if [ -d $f -o -f $f ]; then
      SetFilePerm $f
   fi
done

for file in $SUIDFILES; do
   # rsh etc. may be missing
   if [ -f $file ]; then
      # Windows NFS Server does not like suid files
      if [ "`echo $file | grep win32-x86`" != "" ]; then
         chmod 511 $file
      else
         chmod 4511 $file
      fi
   fi
done

$ECHO
$ECHO "Your file permissions were set"
$ECHO