Date: Thu, 11 Nov 1999 02:49:12 +0800 (WST) From: Michael Kennett <mike@laurasia.com.au> To: keith@mail.telestream.com Cc: freebsd-questions@freebsd.org Subject: Re: Testing file permissions Message-ID: <199911101849.CAA12198@laurasia.com.au> In-Reply-To: <Pine.LNX.4.10.9911101006440.13100-100000@mail.telestream.com> from "keith@mail.telestream.com" at "Nov 10, 99 10:08:49 am"
next in thread | previous in thread | raw e-mail | index | archive | help
> You can just test the file attributes...
>
> -d file exists and is a directory
> -e file exists
> -f file exists and is a regular file
> -r you have read permissions on the file
> -s file exists and is not empy
> -w You have write permisions on the file
> -x You have execute permissions on the file
> -O You own the file
> -G Files group IS matches yours
^^^^^ (Note these!)
That is not quite what I want to do. These tests (and their results) apply
to the user/group id of the process conducting the test.
What I'd like to determine is the user/group that owns the file, and what
the three different levels of access (world/group/user) are. In other
words, rather than finding out if the *current* process can access the
file, I'd like to know (in the script) what the full mode of the access
to the file is.
For a human, it is easy enough to read off this information from the `ls -l'
command. To emulate this is in an automated script seems to require a
reasonable amount of text processing - which strikes me as rather kludgy!
Regards,
Mike Kennett
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911101849.CAA12198>
