OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / setfsuid.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Created   1995-08-06 Thomas K. Dyas <tdyas@eden.rutgers.edu>
24 .\" Modified  2000-07-01 aeb
25 .\" Modified  2002-07-23 aeb
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"     Added notes on capability requirements
28 .\"
29 .TH SETFSUID 2 2008-12-05 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 setfsuid \- set user identity used for file system checks
32 .SH SYNOPSIS
33 .B #include <unistd.h>
34 /* glibc uses <sys/fsuid.h> */
35 .sp
36 .BI "int setfsuid(uid_t " fsuid );
37 .SH DESCRIPTION
38 The system call
39 .BR setfsuid ()
40 sets the user ID that the Linux kernel uses to check for all accesses
41 to the file system.
42 Normally, the value of
43 .I fsuid
44 will shadow the value of the effective user ID.
45 In fact, whenever the
46 effective user ID is changed,
47 .I fsuid
48 will also be changed to the new value of the effective user ID.
49
50 Explicit calls to
51 .BR setfsuid ()
52 and
53 .BR setfsgid (2)
54 are usually only used by programs such as the Linux NFS server that
55 need to change what user and group ID is used for file access without a
56 corresponding change in the real and effective user and group IDs.
57 A change in the normal user IDs for a program such as the NFS server
58 is a security hole that can expose it to unwanted signals.
59 (But see below.)
60
61 .BR setfsuid ()
62 will only succeed if the caller is the superuser or if
63 .I fsuid
64 matches either the real user ID, effective user ID, saved set-user-ID, or
65 the current value of
66 .IR fsuid .
67 .SH "RETURN VALUE"
68 On success, the previous value of
69 .I fsuid
70 is returned.
71 On error, the current value of
72 .I fsuid
73 is returned.
74 .SH VERSIONS
75 This system call is present in Linux since version 1.2.
76 .\" This system call is present since Linux 1.1.44
77 .\" and in libc since libc 4.7.6.
78 .SH "CONFORMING TO"
79 .BR setfsuid ()
80 is Linux-specific and should not be used in programs intended
81 to be portable.
82 .SH NOTES
83 When glibc determines that the argument is not a valid user ID,
84 it will return \-1 and set \fIerrno\fP to
85 .B EINVAL
86 without attempting
87 the system call.
88 .LP
89 Note that at the time this system call was introduced, a process
90 could send a signal to a process with the same effective user ID.
91 Today signal permission handling is slightly different.
92 .SH BUGS
93 No error messages of any kind are returned to the caller.
94 At the very
95 least,
96 .B EPERM
97 should be returned when the call fails (because the caller lacks the
98 .B CAP_SETUID
99 capability).
100 .SH "SEE ALSO"
101 .BR kill (2),
102 .BR setfsgid (2),
103 .BR capabilities (7),
104 .BR credentials (7)