~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man7/capabilities.7

  • Committer: Bazaar Package Importer
  • Author(s): Joey Schulze
  • Date: 2010-03-02 21:49:58 UTC
  • mfrom: (1.1.42 upstream) (2.2.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100302214958-69yjgb70t7wrjo3m
New upstream version
. Remove crufty statement in setuid(2) that seteuid() is not in POSIX
(closes: Bug#569812)
. Fix description of 'nochdir' argument in daemon(3) (closes: Bug#554819)
. Fix NAME line in path_resolution(7) (closes: Bug#558300)

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
.\"     capability, then we must also set the effective flag for all
43
43
.\"     other capabilities where the permitted or inheritable bit is set.
44
44
.\"
45
 
.TH CAPABILITIES 7 2009-08-03 "Linux" "Linux Programmer's Manual"
 
45
.TH CAPABILITIES 7 2010-01-31 "Linux" "Linux Programmer's Manual"
46
46
.SH NAME
47
47
capabilities \- overview of Linux capabilities
48
48
.SH DESCRIPTION
52
52
processes (whose effective user ID is 0, referred to as superuser or root),
53
53
and
54
54
.I unprivileged
55
 
processes (whose effective UID is non-zero).
 
55
processes (whose effective UID is nonzero).
56
56
Privileged processes bypass all kernel permission checks,
57
57
while unprivileged processes are subject to full permission
58
58
checking based on the process's credentials
416
416
the kernel must check whether the thread has the required
417
417
capability in its effective set.
418
418
.IP 2.
419
 
The kernel must provide
420
 
system calls allowing a thread's capability sets to
 
419
The kernel must provide system calls allowing a thread's capability sets to
421
420
be changed and retrieved.
422
421
.IP 3.
423
422
The file system must support attaching capabilities to an executable file,
439
438
capability in its effective set.
440
439
 
441
440
If a thread drops a capability from its permitted set,
442
 
it can never re-acquire that capability (unless it
 
441
it can never reacquire that capability (unless it
443
442
.BR execve (2)s
444
443
either a set-user-ID-root program, or
445
444
a program whose associated file capabilities grant that capability).
573
572
a program,
574
573
it gains all capabilities in its permitted and effective capability sets,
575
574
except those masked out by the capability bounding set.
576
 
.\" If a process with real UID 0, and non-zero effective UID does an
 
575
.\" If a process with real UID 0, and nonzero effective UID does an
577
576
.\" exec(), then it gets all capabilities in its
578
577
.\" permitted set, and no effective capabilities
579
578
This provides semantics that are the same as those provided by
690
689
.\"
691
690
.SS Effect of User ID Changes on Capabilities
692
691
To preserve the traditional semantics for transitions between
693
 
0 and non-zero user IDs,
 
692
0 and nonzero user IDs,
694
693
the kernel makes the following changes to a thread's capability
695
694
sets on changes to the thread's real, effective, saved set,
696
695
and file system user IDs (using
700
699
.IP 1. 3
701
700
If one or more of the real, effective or saved set user IDs
702
701
was previously 0, and as a result of the UID changes all of these IDs
703
 
have a non-zero value,
 
702
have a nonzero value,
704
703
then all capabilities are cleared from the permitted and effective
705
704
capability sets.
706
705
.IP 2.
707
 
If the effective user ID is changed from 0 to non-zero,
 
706
If the effective user ID is changed from 0 to nonzero,
708
707
then all capabilities are cleared from the effective set.
709
708
.IP 3.
710
 
If the effective user ID is changed from non-zero to 0,
 
709
If the effective user ID is changed from nonzero to 0,
711
710
then the permitted set is copied to the effective set.
712
711
.IP 4.
713
 
If the file system user ID is changed from 0 to non-zero (see
 
712
If the file system user ID is changed from 0 to nonzero (see
714
713
.BR setfsuid (2))
715
714
then the following capabilities are cleared from the effective set:
716
715
.BR CAP_CHOWN ,
724
723
and
725
724
.B CAP_MKNOD
726
725
(since Linux 2.2.30).
727
 
If the file system UID is changed from non-zero to 0,
 
726
If the file system UID is changed from nonzero to 0,
728
727
then any of these capabilities that are enabled in the permitted set
729
728
are enabled in the effective set.
730
729
.PP
731
730
If a thread that has a 0 value for one or more of its user IDs wants
732
731
to prevent its permitted capability set being cleared when it resets
733
 
all of its user IDs to non-zero values, it can do so using the
 
732
all of its user IDs to nonzero values, it can do so using the
734
733
.BR prctl (2)
735
734
.B PR_SET_KEEPCAPS
736
735
operation.
778
777
.RI ( root ).
779
778
These flags are as follows:
780
779
.TP
781
 
.B SECURE_KEEP_CAPS
 
780
.B SECBIT_KEEP_CAPS
782
781
Setting this flag allows a thread that has one or more 0 UIDs to retain
783
 
its capabilities when it switches all of its UIDs to a non-zero value.
 
782
its capabilities when it switches all of its UIDs to a nonzero value.
784
783
If this flag is not set,
785
784
then such a UID switch causes the thread to lose all capabilities.
786
785
This flag is always cleared on an
790
789
.B PR_SET_KEEPCAPS
791
790
operation.)
792
791
.TP
793
 
.B SECURE_NO_SETUID_FIXUP
 
792
.B SECBIT_NO_SETUID_FIXUP
794
793
Setting this flag stops the kernel from adjusting  capability sets when
795
794
the threads's effective and file system UIDs are switched between
796
 
zero and non-zero values.
 
795
zero and nonzero values.
797
796
(See the subsection
798
797
.IR "Effect of User ID Changes on Capabilities" .)
799
798
.TP
800
 
.B SECURE_NOROOT
 
799
.B SECBIT_NOROOT
801
800
If this bit is set, then the kernel does not grant capabilities
802
801
when a set-user-ID-root program is executed, or when a process with
803
802
an effective or real UID of 0 calls
810
809
and has the effect of preventing further changes to the
811
810
corresponding "base" flag.
812
811
The locked flags are:
813
 
.BR SECURE_KEEP_CAPS_LOCKED ,
814
 
.BR SECURE_NO_SETUID_FIXUP_LOCKED ,
 
812
.BR SECBIT_KEEP_CAPS_LOCKED ,
 
813
.BR SECBIT_NO_SETUID_FIXUP_LOCKED ,
815
814
and
816
 
.BR SECURE_NOROOT_LOCKED .
 
815
.BR SECBIT_NOROOT_LOCKED .
817
816
.PP
818
817
The
819
818
.I securebits
844
843
.nf
845
844
 
846
845
prctl(PR_SET_SECUREBITS,
847
 
        1 << SECURE_KEEP_CAPS_LOCKED |
848
 
        1 << SECURE_NO_SETUID_FIXUP |
849
 
        1 << SECURE_NO_SETUID_FIXUP_LOCKED |
850
 
        1 << SECURE_NOROOT |
851
 
        1 << SECURE_NOROOT_LOCKED);
 
846
        SECBIT_KEEP_CAPS_LOCKED |
 
847
        SECBIT_NO_SETUID_FIXUP |
 
848
        SECBIT_NO_SETUID_FIXUP_LOCKED |
 
849
        SECBIT_NOROOT |
 
850
        SECBIT_NOROOT_LOCKED);
852
851
.fi
853
852
.in
854
853
.SH "CONFORMING TO"
924
923
.I include/linux/capability.h
925
924
in the kernel source
926
925
.SH COLOPHON
927
 
This page is part of release 3.23 of the Linux
 
926
This page is part of release 3.24 of the Linux
928
927
.I man-pages
929
928
project.
930
929
A description of the project,