1 .TH "chcontext" "8" "0.1.0" "Klavs Klavsen <kl@vsen.dk>" "System Administration"
4 chcontext \- chcontext allocates a new security context and executes a command in that context.
7 chcontext [\fIoptions\fP] <\fIcommand arguments\fP>
10 chcontext allocates a new security context and executes a command in that context.
11 By default, a new/unused context is allocated
15 \fB\-\-cap\fR CAP_NAME
16 Add a capability from the command. This option may be repeated several time. See /usr/include/linux/capability.h In general, this option is used with the \-\-secure option. \-\-secure removes most critical capabilities and \-\-cap adds specific ones.
18 \fB\-\-cap\fR !CAP_NAME
19 Remove a capability from the command. This option may be repeated several time. See /usr/include/linux/capability.h
22 Select the context. Only root in context 0 is allowed to select a specific context.
23 Context number 1 is special. It can see all processes in any contexts, but can't kill them though.
26 Start the command in background and make the process a child of process 1.
28 \fB\-\-domainname\fR new_domainname
29 Set the domainname (NIS) in the new security context.
30 Use "none" to unset the domainname.
33 Set one flag in the new or current security context. The following flags are supported. The option may be used several time.
34 lock: The new process is trapped and can't use
36 sched: The new process and its children will
37 share a common execution priority.
38 nproc: Limit the number of process in the
39 vserver according to ulimit setting.
40 Normally, ulimit is a per user thing.
41 With this flag, it becomes a per vserver
43 private: No one can join this security context
46 \fB\-\-hostname\fR new_hostname
47 Set the hostname in the new security context.
48 This is needed because if you create a less privileged security context, it may be unable to change its hostname.
51 Remove all the capabilities to make a virtual server trustable.
54 Do not print the allocated context number.
56 Information about context is found in /proc/self/status
59 \fI/usr/sbin/chcontext\fP
64 # You must be root, running X.
65 # We start an xterm in another security context
66 /usr/sbin/chcontext xterm &
68 # We check, there is no xterm running, yet we can
72 # Are we running in security context 0
73 # We check the s_context line in /proc/self/status
76 # Ok we in security context 0
77 # Try the security context 1
78 /usr/sbin/chcontext \-\-ctx 1 ps ax | grep xterm
80 # Ok, we see the xterm, we try to kill it
81 /usr/sbin/chcontext \-\-ctx 1 killall xterm
83 # No, security context 1 can see, but can't kill
84 # let's find out in which security context this
86 /usr/sbin/chcontext \-\-ctx 1 ps ax | grep xterm
88 # Ok, this is PID XX. We need the security context
89 /usr/sbin/chcontext \-\-ctx 1 cat /proc/XX/status
91 # We see the s_context, this is SS.
92 # We want to kill this process
93 /usr/sbin/chcontext \-\-ctx SS killall xterm
95 Please contribute some, if you feel it's important.
98 This Man page was written by Klavs Klavsen <kl@vsen.dk> and based upon the helpful output from the program itself and the documentation on the Virtual Server site <http://www.solucorp.qc.ca/miscprj/s_context.hc?prjstate=1&nodoc=0>
101 chbind(8) rebootmgr(8) reducecap(8)
102 vps(8) vpstree(8) vrpm(8) vserver(8)
103 vserver\-stat(8) vtop(8)