Problem
The error message "Permission denied" appears when trying to access a regular file or directory, or there are other indications that an operation is failing due to improper permissions. Utilities for checking and repairing permissions, such as those detailed in SCO Technical Articles ta105410 ("Filesystem Repair Utilities for SCO UNIX Release 3.2 Version 4.2") and ta105411 ("Filesystem Repair Utilities for SCO OpenServer 5.0.0, 5.0.2 and 5.0.4"), haven't resolved the problem.
Cause
On each attempt to access a file, before granting access, the system checks that the owner and group associated with the process are sufficient for it to access each directory in the file's path, as well as those of each directory of new paths referred to by symbolic links. If the process doesn't have sufficient permission to access any directory in these paths, access is denied to the file. The utilities ordinarily used by system administrators to verify and fix permissions rely on perms list, or product or component database entries. If database files or entries are missing, incomplete, incorrect, or corrupt, due to activity on the system or a software bug (such as the product being shipped with missing, incomplete, or incorrect database files), or if the administrator wants to verify permissions without relying on database entries, then the permissions must be inspected and corrected manually. The permissions on files may be incorrect for similar reasons: a software bug or activity on the system.
Solution
The diagnostic script below can be used to prepare for inspection a complete permissions listing related to a given file. The output can be forwarded to Technical Support to facilitate resolving permissions-related problems.
Place the script in the system administrator's path, and make it executable. The optional argument to the script is an absolute or relative path; when the script is invoked with no argument, the current working directory is used.
For example, when the script is run on an OpenServer 5.0.4 system:
# chkperm /usr/adm
drwxr-xr-x root bin /
drwxrwxr-x root auth /usr
lrwxrwxrwx root root /usr/adm
drwxr-xr-x root bin /
drwxr-xr-x root sys /var
drwxr-xr-x adm bin /var/admThe script will abort if a symlink loop is detected (see the ln man page).
NOTE: The error message "Permission denied" may appear in some contexts
that have nothing to do with ordinary file permissions, as, for
example, when a remote command lacks authorization to run. See also
The manual pages for chmod and ln.
================================/cut here/=====================================
:
# chkperm: check all permissions associated with a file.
# usage: chkperm [ relative path | absolute path ]
# Current working directory assumed if no path specified.
#
# Not supported. Provided "AS IS" to knowledgeable users as a courtesy.
#
# 1 2 3 4 5 6 7 8 9 10 11 12
# 2012 lrwxrwxrwx 1 root root 8 Jul 29 18:19 /usr/adm -> /var/adm
awk '
BEGIN {
if (ARGC > 1)
path = ARGV[1]
else
path = "."
if (path !~ "^/") {
cmd = cmd "pwd"
cmd | getline pwd
close(cmd)
if (path == ".")
path = pwd
else
path = pwd "/" path
}
npath = "/"
while (path != "") {
cmd = "ls -ild -- " npath
cmd | getline
close(cmd)
printf "%-9s %-8s %-8s %-s\n", $2, $4, $5, npath
#print $2 " " npath
sub("^[^/]*/?","",path)
if ($2 ~ /^l/) {
if ($1 in inodes) {
printf "Symlink loop detected (see the ln man page). Aborting.\n"
exit(1)
}
inodes[$1]
if (path == "")
path = $12
else
path = $12 "/" path
npath = ""
}
component = path
sub("/.*","",component)
if (npath == "/")
npath = npath component
else
npath = npath "/" component
}
}
' "$@"
================================/cut here/=====================================