summaryrefslogtreecommitdiff
path: root/manual/filesys.texi
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-20 04:59:24 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-20 04:59:24 +0000
commit3a4cbb41861badaf557b1896542c00d4f40d9f45 (patch)
tree156bc6fb89961a5905239aa7dbc1affa3fd06b5d /manual/filesys.texi
parent1d8004b2760e61d7e9fd67caa42bd6d0004a9f9d (diff)
Update.
* manual/filesys.texi (Testing File Access): Correct description of SUID. 1999-08025 H.J. Lu <hjl@gnu.org> * csu/defs.awk (.end): Only match with leading white spaces. (.align): Likewise. 1999-09-19 Ulrich Drepper <drepper@cygnus.com>
Diffstat (limited to 'manual/filesys.texi')
-rw-r--r--manual/filesys.texi27
1 files changed, 14 insertions, 13 deletions
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 728b904d66..5a3f0c51be 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -2267,19 +2267,20 @@ The file resides on a read-only file system.
@cindex access, testing for
@cindex setuid programs and file access
-When a program runs as a privileged user, this permits it to access
-files off-limits to ordinary users---for example, to modify
-@file{/etc/passwd}. Programs designed to be run by ordinary users but
-access such files use the setuid bit feature so that they always run
-with @code{root} as the effective user ID.
-
-Since the program runs as @code{root}, it has permission to access
-whatever file the user specifies---but usually the desired behavior is
-to permit only those files which the user could ordinarily access.
-
-The program therefore must explicitly check whether @emph{the user}
-would have the necessary access to a file, before it reads or writes the
-file.
+In some situations it is desirable to allow programs to access files or
+devices even if this is not possible with the permissions granted to the
+user. One possible solution is to set the setuid-bit of the program
+file. If such a program is started the @emph{effective} user ID of the
+process is changed to that of the owner of the program file. So to
+allow write access to files like @file{/etc/passwd}, which normally can
+be written only by the super-user, the modifying program will have to be
+owned by @code{root} and the setuid-bit must be set.
+
+But beside the files the program is intended to change the user should
+not be allowed to access any file to which s/he would not have access
+anyway. The program therefore must explicitly check whether @emph{the
+user} would have the necessary access to a file, before it reads or
+writes the file.
To do this, use the function @code{access}, which checks for access
permission based on the process's @emph{real} user ID rather than the