Debian Codegraph @

po/ar/man7/user_namespaces.7.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: manpages-l10n 4.30.1\n"
9 "POT-Creation-Date: 2026-06-05 06:50+0200\n"
10 "PO-Revision-Date: 2026-06-06 10:37+0400\n"
11 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
12 "Language-Team: Arabic <[email protected]>\n"
13 "Language: ar\n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&"
18 " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
19 "X-Generator: Lokalize 23.08.5\n"
20
21 #. type: TH
22 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
23 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
24 #, no-wrap
25 msgid "user_namespaces"
26 msgstr "user_namespaces"
27
28 #. type: TH
29 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
30 #: opensuse-tumbleweed
31 #, no-wrap
32 msgid "2026-02-08"
33 msgstr "8 فبراير 2026"
34
35 #. type: TH
36 #: archlinux debian-unstable
37 #, no-wrap
38 msgid "Linux man-pages 6.18"
39 msgstr "صفحات دليل لينكس 6.18"
40
41 #. type: SH
42 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
43 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
44 #, no-wrap
45 msgid "NAME"
46 msgstr "الاسم"
47
48 #. type: Plain text
49 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
50 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
51 msgid "user_namespaces - overview of Linux user namespaces"
52 msgstr "user_namespaces - نظرة عامة على مساحات أسماء المستخدمين في لينكس"
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "DESCRIPTION"
59 msgstr "الوصف"
60
61 #. type: Plain text
62 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
63 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
64 msgid "For an overview of namespaces, see B<namespaces>(7)."
65 msgstr "للحصول على نظرة عامة على مساحات الأسماء، انظر B<namespaces>(7)."
66
67 #
68 #. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
69 #. FIXME: This page says very little about the interaction
70 #. of user namespaces and keys. Add something on this topic.
71 #. ============================================================
72 #. type: Plain text
73 #. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
74 #. FIXME: This page says very little about the interaction
75 #. of user namespaces and keys. Add something on this topic.
76 #. ============================================================
77 #. type: Plain text
78 #. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
79 #. FIXME: This page says very little about the interaction
80 #. of user namespaces and keys. Add something on this topic.
81 #. ============================================================
82 #. type: Plain text
83 #. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
84 #. FIXME: This page says very little about the interaction
85 #. of user namespaces and keys. Add something on this topic.
86 #. ============================================================
87 #. type: Plain text
88 #. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
89 #. FIXME: This page says very little about the interaction
90 #. of user namespaces and keys. Add something on this topic.
91 #. ============================================================
92 #. type: Plain text
93 #. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
94 #. FIXME: This page says very little about the interaction
95 #. of user namespaces and keys. Add something on this topic.
96 #. ============================================================
97 #. type: Plain text
98 #. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
99 #. FIXME: This page says very little about the interaction
100 #. of user namespaces and keys. Add something on this topic.
101 #. ============================================================
102 #. type: Plain text
103 #. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
104 #. FIXME: This page says very little about the interaction
105 #. of user namespaces and keys. Add something on this topic.
106 #. ============================================================
107 #. type: Plain text
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 msgid ""
111 "User namespaces isolate security-related identifiers and attributes, in "
112 "particular, user IDs and group IDs (see B<credentials>(7)), the root "
113 "directory, keys (see B<keyrings>(7)), and capabilities (see "
114 "B<capabilities>(7)). A process's user and group IDs can be different inside "
115 "and outside a user namespace. In particular, a process can have a normal "
116 "unprivileged user ID outside a user namespace while at the same time having "
117 "a user ID of 0 inside the namespace; in other words, the process has full "
118 "privileges for operations inside the user namespace, but is unprivileged for "
119 "operations outside the namespace."
120 msgstr ""
121 "مساحات أسماء المستخدمين تعزل المعرفات والسمات المتعلقة بالأمان، وتحديدًا "
122 "معرفات المستخدم والمجموعة (انظر B<credentials>(7))، والدليل الجذر، والمفاتيح "
123 "(انظر B<keyrings>(7))، والصلاحيات (انظر B<capabilities>(7)). يمكن أن تكون "
124 "معرفات المستخدم والمجموعة لعملية ما مختلفة داخل مساحة اسم المستخدم وخارجها. "
125 "على وجه الخصوص، يمكن أن يكون لعملية ما معرف مستخدم عادي غير مميز خارج مساحة "
126 "اسم المستخدم بينما يكون لديها في نفس الوقت معرف مستخدم بقيمة 0 داخل المساحة؛ "
127 "بمعنى آخر، تمتلك العملية صلاحيات كاملة للعمليات داخل مساحة اسم المستخدم، "
128 "ولكنها غير مميزة للعمليات خارج المساحة."
129
130 #. type: SS
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 #, no-wrap
134 msgid "Nested namespaces, namespace membership"
135 msgstr "مساحات الأسماء المتداخلة، العضوية في مساحة الاسم"
136
137 #. type: Plain text
138 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
139 #: opensuse-tumbleweed
140 msgid ""
141 "User namespaces can be nested; that is, each user namespace \\[em]except the "
142 "initial (\"root\") namespace\\[em] has a parent user namespace, and can have "
143 "zero or more child user namespaces. The parent user namespace is the user "
144 "namespace of the process that creates the user namespace via a call to "
145 "B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
146 msgstr ""
147 "يمكن أن تكون مساحات أسماء المستخدمين متداخلة؛ أي أن كل مساحة اسم مستخدم "
148 "\\[em]باستثناء المساحة الأولية (\"الجذر\")\\[em] لها مساحة اسم مستخدم أب، "
149 "ويمكن أن تحتوي على صفر أو أكثر من مساحات أسماء المستخدمين الفرعية. مساحة "
150 "اسم المستخدم الأب هي مساحة اسم المستخدم للعملية التي تنشئ مساحة اسم المستخدم "
151 "عبر استدعاء B<unshare>(2) أو B<clone>(2) مع العلم B<CLONE_NEWUSER>."
152
153 #. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8
154 #. FIXME Explain the rationale for this limit. (What is the rationale?)
155 #. type: Plain text
156 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
157 #: opensuse-tumbleweed
158 msgid ""
159 "The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user "
160 "namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this "
161 "limit to be exceeded fail with the error B<EUSERS>."
162 msgstr ""
163 "يفرض النواة (منذ لينكس 3.11) حدًا أقصى يبلغ 32 مستوى متداخلًا من مساحات أسماء "
164 "المستخدمين. تفشل استدعاءات B<unshare>(2) أو B<clone>(2) التي قد تتسبب في "
165 "تجاوز هذا الحد مع الخطأ B<EUSERS>."
166
167 #. type: Plain text
168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
170 msgid ""
171 "Each process is a member of exactly one user namespace. A process created "
172 "via B<fork>(2) or B<clone>(2) without the B<CLONE_NEWUSER> flag is a "
173 "member of the same user namespace as its parent. A single-threaded process "
174 "can join another user namespace with B<setns>(2) if it has the "
175 "B<CAP_SYS_ADMIN> in that namespace; upon doing so, it gains a full set of "
176 "capabilities in that namespace."
177 msgstr ""
178 "كل عملية هي عضو في مساحة اسم مستخدم واحدة بالضبط. العملية المنشأة عبر "
179 "B<fork>(2) أو B<clone>(2) بدون العلم B<CLONE_NEWUSER> هي عضو في نفس مساحة "
180 "اسم المستخدم مثل أبويها. يمكن لعملية أحادية الخيط الانضمام إلى مساحة اسم "
181 "مستخدم أخرى باستخدام B<setns>(2) إذا كانت تمتلك B<CAP_SYS_ADMIN> في تلك "
182 "المساحة؛ عند القيام بذلك، تكتسب مجموعة كاملة من الصلاحيات في تلك المساحة."
183
184 #. type: Plain text
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 msgid ""
188 "A call to B<clone>(2) or B<unshare>(2) with the B<CLONE_NEWUSER> flag "
189 "makes the new child process (for B<clone>(2)) or the caller (for "
190 "B<unshare>(2)) a member of the new user namespace created by the call."
191 msgstr ""
192 "استدعاء B<clone>(2) أو B<unshare>(2) مع العلم B<CLONE_NEWUSER> يجعل "
193 "العملية الفرعية الجديدة (لـ B<clone>(2)) أو المستدعي (لـ B<unshare>(2)) "
194 "عضوًا في مساحة اسم المستخدم الجديدة المنشأة بواسطة الاستدعاء."
195
196 #. type: Plain text
197 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
198 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
199 msgid ""
200 "The B<NS_GET_PARENT> B<ioctl>(2) operation can be used to discover the "
201 "parental relationship between user namespaces; see B<ioctl_nsfs>(2)."
202 msgstr ""
203 "يمكن استخدام عملية B<NS_GET_PARENT> B<ioctl>(2) لاكتشاف العلاقة الأبوية بين "
204 "مساحات أسماء المستخدمين؛ انظر B<ioctl_nsfs>(2)."
205
206 #
207 #. ============================================================
208 #. type: Plain text
209 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
210 #: opensuse-tumbleweed
211 msgid ""
212 "A task that changes one of its effective IDs will have its dumpability reset "
213 "to the value in I</proc/sys/fs/suid_dumpable>. This may affect the "
214 "ownership of proc files of child processes and may thus cause the parent to "
215 "lack the permissions to write to mapping files of child processes running in "
216 "a new user namespace. In such cases, making the parent process dumpable, "
217 "using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child "
218 "process in a new user namespace may rectify this problem. See B<prctl>(2) "
219 "and B<proc>(5) for details on how ownership is affected."
220 msgstr ""
221 "المهمة التي تغير أحد معرفاتها الفعالة ستعيد تعيين قابلية التفريغ الخاصة بها "
222 "إلى القيمة في I</proc/sys/fs/suid_dumpable>. قد يؤثر هذا على ملكية ملفات "
223 "proc للعمليات الفرعية وقد يتسبب بالتالي في افتقار العملية الأب للأذونات "
224 "اللازمة للكتابة إلى ملفات التعيين للعمليات الفرعية التي تعمل في مساحة اسم "
225 "مستخدم جديدة. في مثل هذه الحالات، جعل العملية الأب قابلة للتفريغ، باستخدام "
226 "B<PR_SET_DUMPABLE> في استدعاء B<prctl>(2)، قبل إنشاء عملية فرعية في مساحة "
227 "اسم مستخدم جديدة قد يصحح هذه المشكلة. انظر B<prctl>(2) و B<proc>(5) "
228 "للحصول على تفاصيل حول كيفية تأثر الملكية."
229
230 #. type: SS
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 #, no-wrap
234 msgid "Capabilities"
235 msgstr "القدرات"
236
237 #. type: Plain text
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 msgid ""
241 "The child process created by B<clone>(2) with the B<CLONE_NEWUSER> flag "
242 "starts out with a complete set of capabilities in the new user namespace. "
243 "Likewise, a process that creates a new user namespace using B<unshare>(2) "
244 "or joins an existing user namespace using B<setns>(2) gains a full set of "
245 "capabilities in that namespace. On the other hand, that process has no "
246 "capabilities in the parent (in the case of B<clone>(2)) or previous (in the "
247 "case of B<unshare>(2) and B<setns>(2)) user namespace, even if the new "
248 "namespace is created or joined by the root user (i.e., a process with user "
249 "ID 0 in the root namespace)."
250 msgstr ""
251 "العملية الفرعية المنشأة بواسطة B<clone>(2) مع العلم B<CLONE_NEWUSER> تبدأ "
252 "بمجموعة كاملة من الصلاحيات في مساحة اسم المستخدم الجديدة. وبالمثل، العملية "
253 "التي تنشئ مساحة اسم مستخدم جديدة باستخدام B<unshare>(2) أو تنضم إلى مساحة "
254 "اسم مستخدم موجودة باستخدام B<setns>(2) تكتسب مجموعة كاملة من الصلاحيات في "
255 "تلك المساحة. من ناحية أخرى، لا تمتلك تلك العملية أي صلاحيات في مساحة اسم "
256 "المستخدم الأب (في حالة B<clone>(2)) أو السابقة (في حالة B<unshare>(2) و "
257 "B<setns>(2))، حتى لو تم إنشاء المساحة الجديدة أو الانضمام إليها بواسطة "
258 "المستخدم الجذر (أي عملية بمعرف مستخدم 0 في مساحة الاسم الجذر)."
259
260 #. type: Plain text
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 msgid ""
264 "Note that a call to B<execve>(2) will cause a process's capabilities to be "
265 "recalculated in the usual way (see B<capabilities>(7)). Consequently, "
266 "unless the process has a user ID of 0 within the namespace, or the "
267 "executable file has a nonempty inheritable capabilities mask, the process "
268 "will lose all capabilities. See the discussion of user and group ID "
269 "mappings, below."
270 msgstr ""
271 "لاحظ أن استدعاء B<execve>(2) سيتسبب في إعادة حساب صلاحيات العملية بالطريقة "
272 "المعتادة (انظر B<capabilities>(7)). وبالتالي، ما لم يكن للعملية معرف مستخدم "
273 "بقيمة 0 داخل مساحة الاسم، أو كان للملف القابل للتنفيذ قناع صلاحيات قابل "
274 "للتوريث غير فارغ، فستفقد العملية جميع الصلاحيات. انظر مناقشة تعيينات معرف "
275 "المستخدم والمجموعة، أدناه."
276
277 #. type: Plain text
278 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
279 #: opensuse-tumbleweed
280 msgid ""
281 "A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or "
282 "a call to B<setns>(2) that moves the caller into another user namespace "
283 "sets the \"securebits\" flags (see B<capabilities>(7)) to their default "
284 "values (all flags disabled) in the child (for B<clone>(2)) or caller (for "
285 "B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has "
286 "capabilities in its original user namespace after a call to B<setns>(2), it "
287 "is not possible for a process to reset its \"securebits\" flags while "
288 "retaining its user namespace membership by using a pair of B<setns>(2) "
289 "calls to move to another user namespace and then return to its original user "
290 "namespace."
291 msgstr ""
292 "استدعاء B<clone>(2) أو B<unshare>(2) باستخدام العلم B<CLONE_NEWUSER> أو "
293 "استدعاء B<setns>(2) الذي ينقل المستدعي إلى مساحة اسم مستخدم أخرى يضبط أعلام "
294 "\"securebits\" (انظر B<capabilities>(7)) على قيمها المبدئية (جميع الأعلام "
295 "معطلة) في الفرع (لـ B<clone>(2)) أو المستدعي (لـ B<unshare>(2) أو "
296 "B<setns>(2)). لاحظ أنه نظرًا لأن المستدعي لم يعد يمتلك صلاحيات في مساحة اسم "
297 "المستخدم الأصلية بعد استدعاء B<setns>(2)، فليس من الممكن لعملية إعادة تعيين "
298 "أعلام \"securebits\" الخاصة بها مع الاحتفاظ بعضويتها في مساحة اسم المستخدم "
299 "باستخدام زوج من استدعاءات B<setns>(2) للانتقال إلى مساحة اسم مستخدم أخرى ثم "
300 "العودة إلى مساحة اسم المستخدم الأصلية."
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid ""
306 "The rules for determining whether or not a process has a capability in a "
307 "particular user namespace are as follows:"
308 msgstr ""
309 "قواعد تحديد ما إذا كانت العملية تمتلك صلاحية في مساحة اسم مستخدم معينة هي "
310 "كما يلي:"
311
312 #. type: IP
313 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
314 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
315 #, no-wrap
316 msgid "\\[bu]"
317 msgstr "\\[bu]"
318
319 #. In the 3.8 sources, see security/commoncap.c::cap_capable():
320 #. type: Plain text
321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
323 msgid ""
324 "A process has a capability inside a user namespace if it is a member of that "
325 "namespace and it has the capability in its effective capability set. A "
326 "process can gain capabilities in its effective capability set in various "
327 "ways. For example, it may execute a set-user-ID program or an executable "
328 "with associated file capabilities. In addition, a process may gain "
329 "capabilities via the effect of B<clone>(2), B<unshare>(2), or B<setns>(2), "
330 "as already described."
331 msgstr ""
332 "تمتلك العملية صلاحية داخل مساحة اسم مستخدم إذا كانت عضوًا في تلك المساحة "
333 "وكانت تمتلك الصلاحية في مجموعة صلاحياتها الفعالة. يمكن للعملية اكتساب "
334 "صلاحيات في مجموعة صلاحياتها الفعالة بطرق مختلفة. على سبيل المثال، قد تنفذ "
335 "برنامج set-user-ID أو ملفًا قابلاً للتنفيذ مع صلاحيات ملف مرتبطة. بالإضافة "
336 "إلى ذلك، قد تكتسب العملية صلاحيات عبر تأثير B<clone>(2)، B<unshare>(2)، أو "
337 "B<setns>(2)، كما هو موصوف بالفعل."
338
339 #. type: Plain text
340 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
341 #: opensuse-tumbleweed
342 msgid ""
343 "If a process has a capability in a user namespace, then it has that "
344 "capability in all child (and further removed descendant) namespaces as well."
345 msgstr ""
346 "إذا كانت العملية تمتلك صلاحية في مساحة اسم مستخدم، فإنها تمتلك تلك الصلاحية "
347 "في جميع مساحات الأسماء الفرعية (والسليلة البعيدة) أيضًا."
348
349 #
350 #. * The owner of the user namespace in the parent of the
351 #. * user namespace has all caps.
352 #. (and likewise associates the effective group ID of the creating process
353 #. with the namespace).
354 #. See kernel commit 520d9eabce18edfef76a60b7b839d54facafe1f9 for a fix
355 #. on this point
356 #. This includes the case where the process executes a set-user-ID
357 #. program that confers the effective UID of the creator of the namespace.
358 #. ============================================================
359 #. type: Plain text
360 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
361 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
362 msgid ""
363 "When a user namespace is created, the kernel records the effective user ID "
364 "of the creating process as being the \"owner\" of the namespace. A process "
365 "that resides in the parent of the user namespace and whose effective user ID "
366 "matches the owner of the namespace has all capabilities in the namespace. "
367 "By virtue of the previous rule, this means that the process has all "
368 "capabilities in all further removed descendant user namespaces as well. The "
369 "B<NS_GET_OWNER_UID> B<ioctl>(2) operation can be used to discover the user "
370 "ID of the owner of the namespace; see B<ioctl_nsfs>(2)."
371 msgstr ""
372 "عند إنشاء مساحة اسم مستخدم، تسجل النواة معرف المستخدم الفعال للعملية المنشئة "
373 "على أنه \"مالك\" المساحة. العملية التي تقع في أب مساحة اسم المستخدم والتي "
374 "يتطابق معرف المستخدم الفعال الخاص بها مع مالك المساحة تمتلك جميع الصلاحيات "
375 "في المساحة. بموجب القاعدة السابقة، هذا يعني أن العملية تمتلك جميع الصلاحيات "
376 "في جميع مساحات أسماء المستخدمين السليلة البعيدة أيضًا. يمكن استخدام عملية "
377 "B<NS_GET_OWNER_UID> B<ioctl>(2) لاكتشاف معرف المستخدم لمالك المساحة؛ انظر "
378 "B<ioctl_nsfs>(2)."
379
380 #. type: SS
381 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
382 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
383 #, no-wrap
384 msgid "Effect of capabilities within a user namespace"
385 msgstr "تأثير الصلاحيات داخل مساحة اسم المستخدم"
386
387 #. type: Plain text
388 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
389 #: opensuse-tumbleweed
390 msgid ""
391 "Having a capability inside a user namespace permits a process to perform "
392 "operations (that require privilege) only on resources governed by that "
393 "namespace. In other words, having a capability in a user namespace permits "
394 "a process to perform privileged operations on resources that are governed by "
395 "(nonuser) namespaces owned by (associated with) the user namespace (see the "
396 "next subsection)."
397 msgstr ""
398 "امتلاك صلاحية داخل مساحة اسم مستخدم يسمح للعملية بتنفيذ عمليات (تتطلب "
399 "امتيازًا) فقط على الموارد التي تحكمها تلك المساحة. بمعنى آخر، امتلاك صلاحية "
400 "في مساحة اسم مستخدم يسمح للعملية بتنفيذ عمليات مميزة على الموارد التي تحكمها "
401 "مساحات أسماء (غير مستخدم) مملوكة (مرتبطة) بمساحة اسم المستخدم (انظر القسم "
402 "الفرعي التالي)."
403
404 #. type: Plain text
405 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
406 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
407 msgid ""
408 "On the other hand, there are many privileged operations that affect "
409 "resources that are not associated with any namespace type, for example, "
410 "changing the system (i.e., calendar) time (governed by B<CAP_SYS_TIME>), "
411 "loading a kernel module (governed by B<CAP_SYS_MODULE>), and creating a "
412 "device (governed by B<CAP_MKNOD>). Only a process with privileges in the "
413 "I<initial> user namespace can perform such operations."
414 msgstr ""
415 "من ناحية أخرى، هناك العديد من العمليات المميزة التي تؤثر على الموارد غير "
416 "المرتبطة بأي نوع من مساحات الأسماء، على سبيل المثال، تغيير وقت النظام (أي "
417 "التقويم) (الذي تحكمه B<CAP_SYS_TIME>)، تحميل وحدة نواة (التي تحكمها "
418 "B<CAP_SYS_MODULE>)، وإنشاء جهاز (الذي تحكمه B<CAP_MKNOD>). فقط عملية ذات "
419 "صلاحيات في مساحة اسم المستخدم I<الأولية> يمكنها تنفيذ مثل هذه العمليات."
420
421 #. fs_flags = FS_USERNS_MOUNT in kernel sources
422 #. type: Plain text
423 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
424 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
425 msgid ""
426 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
427 "mount namespace allows that process to create bind mounts and mount the "
428 "following types of filesystems:"
429 msgstr ""
430 "امتلاك B<CAP_SYS_ADMIN> داخل مساحة اسم المستخدم التي تمتلك مساحة اسم التوصيل "
431 "الخاصة بعملية ما يسمح لتلك العملية بإنشاء توصيلات ربط وتوصيل الأنواع التالية "
432 "من أنظمة الملفات:"
433
434 #. type: Plain text
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 msgid "I</proc> (since Linux 3.8)"
438 msgstr "I</proc> (منذ لينكس 3.8)"
439
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid "I</sys> (since Linux 3.8)"
444 msgstr "I</sys> (منذ لينكس 3.8)"
445
446 #. type: Plain text
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 msgid "I<devpts> (since Linux 3.9)"
450 msgstr "I<devpts> (منذ لينكس 3.9)"
451
452 #. type: Plain text
453 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
454 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
455 msgid "B<tmpfs>(5) (since Linux 3.9)"
456 msgstr "B<tmpfs>(5) (منذ لينكس 3.9)"
457
458 #. type: Plain text
459 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
460 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
461 msgid "I<ramfs> (since Linux 3.9)"
462 msgstr "I<ramfs> (منذ لينكس 3.9)"
463
464 #. type: Plain text
465 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
466 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
467 msgid "I<mqueue> (since Linux 3.9)"
468 msgstr "I<mqueue> (منذ لينكس 3.9)"
469
470 #. commit b2197755b2633e164a439682fb05a9b5ea48f706
471 #. type: Plain text
472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
474 msgid "I<bpf> (since Linux 4.4)"
475 msgstr "I<bpf> (منذ لينكس 4.4)"
476
477 #. commit 92dbc9dedccb9759c7f9f2f0ae6242396376988f
478 #. commit 4cb2c00c43b3fe88b32f29df4f76da1b92c33224
479 #. type: Plain text
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 msgid "I<overlayfs> (since Linux 5.11)"
483 msgstr "I<overlayfs> (منذ لينكس 5.11)"
484
485 #. type: Plain text
486 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
487 #: opensuse-leap-16-1 opensuse-tumbleweed
488 msgid ""
489 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
490 "cgroup namespace allows (since Linux 4.6) that process to mount the cgroup "
491 "version 2 filesystem and cgroup version 1 named hierarchies (i.e., cgroup "
492 "filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)."
493 msgstr ""
494 "امتلاك B<CAP_SYS_ADMIN> داخل مساحة اسم المستخدم التي تملك مساحة اسم cgroup "
495 "لعملية يسمح (منذ لينكس 4.6) لتلك العملية بوصل نظام ملفات cgroup الإصدار 2 "
496 "والتسلسلات الهرمية المسماة لـ cgroup الإصدار 1 (أي أنظمة ملفات cgroup "
497 "الموصولة مع الخيار I<\\[dq]none,name=\\[dq]>)."
498
499 #. type: Plain text
500 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
501 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
502 msgid ""
503 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's PID "
504 "namespace allows (since Linux 3.8) that process to mount I</proc> "
505 "filesystems."
506 msgstr ""
507 "امتلاك B<CAP_SYS_ADMIN> داخل مساحة اسم المستخدم التي تملك مساحة اسم PID "
508 "لعملية يسمح (منذ لينكس 3.8) لتلك العملية بوصل أنظمة ملفات I</proc>."
509
510 #
511 #. ============================================================
512 #. type: Plain text
513 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
514 #: opensuse-tumbleweed
515 msgid ""
516 "However, mounting block-based filesystems can be done only by a process that "
517 "holds B<CAP_SYS_ADMIN> in the initial user namespace."
518 msgstr ""
519 "مع ذلك، وصل أنظمة الملفات القائمة على الكتل يمكن أن يُنجز فقط بواسطة عملية "
520 "تمتلك B<CAP_SYS_ADMIN> في مساحة اسم المستخدم الأولية."
521
522 #. type: SS
523 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
524 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
525 #, no-wrap
526 msgid "Interaction of user namespaces and other types of namespaces"
527 msgstr "تفاعل مساحات اسم المستخدم وأنواع أخرى من مساحات الأسماء"
528
529 #. type: Plain text
530 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
531 #: opensuse-leap-16-1 opensuse-tumbleweed
532 msgid ""
533 "Since Linux 3.8, unprivileged processes can create user namespaces, and the "
534 "other types of namespaces can be created with just the B<CAP_SYS_ADMIN> "
535 "capability in the caller's user namespace."
536 msgstr ""
537 "منذ لينكس 3.8، العمليات غير المميزة يمكنها إنشاء مساحات اسم المستخدم، وأنواع "
538 "مساحات الأسماء الأخرى يمكن إنشاؤها فقط بقابلية B<CAP_SYS_ADMIN> في مساحة اسم "
539 "المستخدم للمتصل."
540
541 #. type: Plain text
542 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
543 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
544 msgid ""
545 "When a nonuser namespace is created, it is owned by the user namespace in "
546 "which the creating process was a member at the time of the creation of the "
547 "namespace. Privileged operations on resources governed by the nonuser "
548 "namespace require that the process has the necessary capabilities in the "
549 "user namespace that owns the nonuser namespace."
550 msgstr ""
551 "عند إنشاء مساحة اسم غير مستخدم، تكون مملوكة لمساحة اسم المستخدم التي كانت "
552 "العملية المنشئة عضوًا فيها وقت إنشاء المساحة. العمليات المميزة على الموارد "
553 "المحكومة بمساحة الاسم غير المستخدم تتطلب أن تمتلك العملية القابليات اللازمة "
554 "في مساحة اسم المستخدم التي تملك مساحة الاسم غير المستخدم."
555
556 #. type: Plain text
557 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
558 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
559 msgid ""
560 "If B<CLONE_NEWUSER> is specified along with other B<CLONE_NEW*> flags in a "
561 "single B<clone>(2) or B<unshare>(2) call, the user namespace is guaranteed "
562 "to be created first, giving the child (B<clone>(2)) or caller "
563 "(B<unshare>(2)) privileges over the remaining namespaces created by the "
564 "call. Thus, it is possible for an unprivileged caller to specify this "
565 "combination of flags."
566 msgstr ""
567 "إذا تم تحديد B<CLONE_NEWUSER> مع أعلام B<CLONE_NEW*> أخرى في استدعاء واحد "
568 "B<clone>(2) أو B<unshare>(2)، يتم ضمان إنشاء مساحة اسم المستخدم أولاً، مما "
569 "يعطي الطفل (B<clone>(2)) أو المتصل (B<unshare>(2)) امتيازات على مساحات "
570 "الأسماء المتبقية المنشأة بواسطة الاستدعاء. وبالتالي، من الممكن لمتصل غير "
571 "مميز تحديد هذه المجموعة من الأعلام."
572
573 #. type: Plain text
574 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
575 #: opensuse-tumbleweed
576 msgid ""
577 "When a new namespace (other than a user namespace) is created via "
578 "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the "
579 "creating process as the owner of the new namespace. (This association can't "
580 "be changed.) When a process in the new namespace subsequently performs "
581 "privileged operations that operate on global resources isolated by the "
582 "namespace, the permission checks are performed according to the process's "
583 "capabilities in the user namespace that the kernel associated with the new "
584 "namespace. For example, suppose that a process attempts to change the "
585 "hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In "
586 "this case, the kernel will determine which user namespace owns the process's "
587 "UTS namespace, and check whether the process has the required capability "
588 "(B<CAP_SYS_ADMIN>) in that user namespace."
589 msgstr ""
590 "عند إنشاء مساحة اسم جديدة (غير مساحة اسم المستخدم) عبر B<clone>(2) أو "
591 "B<unshare>(2)، يسجل النواة مساحة اسم المستخدم للعملية المنشئة كمالك لمساحة "
592 "الاسم الجديدة. (لا يمكن تغيير هذا الارتباط.) عندما تقوم عملية في مساحة الاسم "
593 "الجديدة لاحقًا بعمليات مميزة تعمل على موارد عالمية معزولة بواسطة مساحة الاسم، "
594 "يتم إجراء فحوصات الإذن وفقًا لقابليات العملية في مساحة اسم المستخدم التي "
595 "ربطتها النواة بمساحة الاسم الجديدة. على سبيل المثال، افترض أن عملية تحاول "
596 "تغيير اسم المضيف (B<sethostname>(2))، وهو مورد محكوم بمساحة اسم UTS. في هذه "
597 "الحالة، ستحدد النواة أي مساحة اسم مستخدم تملك مساحة اسم UTS للعملية، وتتحقق "
598 "مما إذا كانت العملية تمتلك القابلية المطلوبة (B<CAP_SYS_ADMIN>) في تلك "
599 "المساحة."
600
601 #
602 #. ============================================================
603 #. type: Plain text
604 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
605 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
606 msgid ""
607 "The B<NS_GET_USERNS> B<ioctl>(2) operation can be used to discover the user "
608 "namespace that owns a nonuser namespace; see B<ioctl_nsfs>(2)."
609 msgstr ""
610 "عملية B<NS_GET_USERNS> B<ioctl>(2) يمكن استخدامها لاكتشاف مساحة اسم المستخدم "
611 "التي تملك مساحة اسم غير مستخدم؛ انظر B<ioctl_nsfs>(2)."
612
613 #. type: SS
614 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
615 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
616 #, no-wrap
617 msgid "User and group ID mappings: uid_map and gid_map"
618 msgstr "تعيينات معرف المستخدم ومعرف المجموعة: uid_map و gid_map"
619
620 #. commit 22d917d80e842829d0ca0a561967d728eb1d6303
621 #. type: Plain text
622 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
623 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
624 msgid ""
625 "When a user namespace is created, it starts out without a mapping of user "
626 "IDs (group IDs) to the parent user namespace. The I</proc/>pidI</uid_map> "
627 "and I</proc/>pidI</gid_map> files (available since Linux 3.5) expose the "
628 "mappings for user and group IDs inside the user namespace for the process "
629 "I<pid>. These files can be read to view the mappings in a user namespace "
630 "and written to (once) to define the mappings."
631 msgstr ""
632 "عند إنشاء مساحة اسم المستخدم، تبدأ بدون تعيين لمعرفات المستخدم (معرفات "
633 "المجموعة) إلى مساحة اسم المستخدم الأم. الملفات I</proc/>pidI</uid_map> و I</"
634 "proc/>pidI</gid_map> (المتاحة منذ لينكس 3.5) تكشف التعيينات لمعرفات المستخدم "
635 "والمجموعة داخل مساحة اسم المستخدم للعملية I<pid>. هذه الملفات يمكن قراءتها "
636 "لعرض التعيينات في مساحة اسم المستخدم والكتابة إليها (مرة واحدة) لتعريف "
637 "التعيينات."
638
639 #. type: Plain text
640 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
641 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
642 msgid ""
643 "The description in the following paragraphs explains the details for "
644 "I<uid_map>; I<gid_map> is exactly the same, but each instance of \"user ID\" "
645 "is replaced by \"group ID\"."
646 msgstr ""
647 "الوصف في الفقرات التالية يشرح التفاصيل لـ I<uid_map>؛ I<gid_map> هو نفسه "
648 "تمامًا، لكن كل حالة من \"معرف المستخدم\" تُستبدل بـ \"معرف المجموعة\"."
649
650 #. type: Plain text
651 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
652 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
653 msgid ""
654 "The I<uid_map> file exposes the mapping of user IDs from the user namespace "
655 "of the process I<pid> to the user namespace of the process that opened "
656 "I<uid_map> (but see a qualification to this point below). In other words, "
657 "processes that are in different user namespaces will potentially see "
658 "different values when reading from a particular I<uid_map> file, depending "
659 "on the user ID mappings for the user namespaces of the reading processes."
660 msgstr ""
661 "ملف I<uid_map> يكشف تعيين معرفات المستخدم من مساحة اسم المستخدم للعملية "
662 "I<pid> إلى مساحة اسم المستخدم للعملية التي فتحت I<uid_map> (لكن انظر تحفظًا "
663 "على هذه النقطة أدناه). بعبارة أخرى، العمليات الموجودة في مساحات اسم مستخدم "
664 "مختلفة قد ترى قيمًا مختلفة عند القراءة من ملف I<uid_map> معين، اعتمادًا على "
665 "تعيينات معرف المستخدم لمساحات اسم المستخدم للعمليات القارئة."
666
667 #. type: Plain text
668 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
669 #: opensuse-leap-16-1 opensuse-tumbleweed
670 msgid ""
671 "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
672 "contiguous user IDs between two user namespaces. (When a user namespace is "
673 "first created, this file is empty.) The specification in each line takes "
674 "the form of three numbers delimited by white space. The first two numbers "
675 "specify the starting user ID in each of the two user namespaces. The third "
676 "number specifies the size of the mapped range. In detail, the fields are "
677 "interpreted as follows:"
678 msgstr ""
679 "كل سطر في ملف I<uid_map> يحدد تعيينًا 1-إلى-1 لنطاق من معرفات المستخدم "
680 "المتجاورة بين مساحتي اسم مستخدم. (عند إنشاء مساحة اسم المستخدم لأول مرة، هذا "
681 "الملف فارغ.) التحديد في كل سطر يأخذ شكل ثلاثة أرقام مفصولة بمسافة بيضاء. "
682 "الرقمان الأولان يحددان معرف المستخدم البادئ في كل من مساحتي اسم المستخدم. "
683 "الرقم الثالث يحدد حجم النطاق المعين. بالتفصيل، الحقول تُفسر كالتالي:"
684
685 #. type: IP
686 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
687 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
688 #, no-wrap
689 msgid "(1)"
690 msgstr "(1)"
691
692 #. type: Plain text
693 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
694 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
695 msgid ""
696 "The start of the range of user IDs in the user namespace of the process "
697 "I<pid>."
698 msgstr "بداية نطاق معرفات المستخدم في مساحة اسم المستخدم للعملية I<pid>."
699
700 #. type: IP
701 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
702 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
703 #, no-wrap
704 msgid "(2)"
705 msgstr "(2)"
706
707 #. type: Plain text
708 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
709 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
710 msgid ""
711 "The start of the range of user IDs to which the user IDs specified by field "
712 "one map. How field two is interpreted depends on whether the process that "
713 "opened I<uid_map> and the process I<pid> are in the same user namespace, as "
714 "follows:"
715 msgstr ""
716 "بداية نطاق معرفات المستخدم التي تُعيّن إليها معرفات المستخدم المحددة بواسطة "
717 "الحقل الأول. كيفية تفسير الحقل الثاني تعتمد على ما إذا كانت العملية التي "
718 "فتحت I<uid_map> والعملية I<pid> في نفس مساحة اسم المستخدم، كالتالي:"
719
720 #. type: IP
721 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
722 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
723 #, no-wrap
724 msgid "(a)"
725 msgstr "(أ)"
726
727 #. type: Plain text
728 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
729 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
730 msgid ""
731 "If the two processes are in different user namespaces: field two is the "
732 "start of a range of user IDs in the user namespace of the process that "
733 "opened I<uid_map>."
734 msgstr ""
735 "إذا كانت العمليتان في مساحتي اسم مستخدم مختلفتين: الحقل الثاني هو بداية نطاق "
736 "معرفات المستخدم في مساحة اسم المستخدم للعملية التي فتحت I<uid_map>."
737
738 #. type: IP
739 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
740 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
741 #, no-wrap
742 msgid "(b)"
743 msgstr "(ب)"
744
745 #. type: Plain text
746 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
747 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
748 msgid ""
749 "If the two processes are in the same user namespace: field two is the start "
750 "of the range of user IDs in the parent user namespace of the process "
751 "I<pid>. This case enables the opener of I<uid_map> (the common case here is "
752 "opening I</proc/self/uid_map>) to see the mapping of user IDs into the user "
753 "namespace of the process that created this user namespace."
754 msgstr ""
755 "إذا كانت العمليتان في نفس مساحة اسم المستخدم: الحقل الثاني هو بداية نطاق "
756 "معرفات المستخدم في مساحة اسم المستخدم الأم للعملية I<pid>. هذه الحالة تمكن "
757 "فاتح I<uid_map> (الحالة الشائعة هنا هي فتح I</proc/self/uid_map>) من رؤية "
758 "تعيين معرفات المستخدم إلى مساحة اسم المستخدم للعملية التي أنشأت هذه المساحة."
759
760 #. type: IP
761 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
762 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
763 #, no-wrap
764 msgid "(3)"
765 msgstr "(3)"
766
767 #. type: Plain text
768 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
769 #: opensuse-leap-16-1 opensuse-tumbleweed
770 msgid ""
771 "The size of the range of user IDs that is mapped between the two user "
772 "namespaces."
773 msgstr "حجم نطاق معرفات المستخدم الذي يُعيّن بين مساحتي اسم المستخدم."
774
775 #. type: Plain text
776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
778 msgid ""
779 "System calls that return user IDs (group IDs)\\[em]for example, "
780 "B<getuid>(2), B<getgid>(2), and the credential fields in the structure "
781 "returned by B<stat>(2)\\[em]return the user ID (group ID) mapped into the "
782 "caller's user namespace."
783 msgstr ""
784 "استدعاءات النظام التي تُرجع معرفات المستخدم (معرفات المجموعة)\\[em]على سبيل "
785 "المثال، B<getuid>(2)، B<getgid>(2)، وحقول الاعتماد في البنية المُعادة بواسطة "
786 "B<stat>(2)\\[em]تُرجع معرف المستخدم (معرف المجموعة) المُعيّن إلى مساحة اسم "
787 "المستخدم للمتصل."
788
789 #. type: Plain text
790 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
791 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
792 msgid ""
793 "When a process accesses a file, its user and group IDs are mapped into the "
794 "initial user namespace for the purpose of permission checking and assigning "
795 "IDs when creating a file. When a process retrieves file user and group IDs "
796 "via B<stat>(2), the IDs are mapped in the opposite direction, to produce "
797 "values relative to the process user and group ID mappings."
798 msgstr ""
799 "عند وصول عملية إلى ملف، تُعيّن معرفات المستخدم والمجموعة الخاصة بها إلى مساحة "
800 "اسم المستخدم الأولية لغرض فحص الإذن وتعيين المعرفات عند إنشاء ملف. عندما "
801 "تسترجع عملية معرفات المستخدم والمجموعة للملف عبر B<stat>(2)، تُعيّن المعرفات "
802 "في الاتجاه المعاكس، لإنتاج قيم نسبية لتعيينات معرف المستخدم والمجموعة "
803 "للعملية."
804
805 #. type: Plain text
806 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
807 #: opensuse-tumbleweed
808 msgid ""
809 "The initial user namespace has no parent namespace, but, for consistency, "
810 "the kernel provides dummy user and group ID mapping files for this "
811 "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a "
812 "shell in the initial namespace shows:"
813 msgstr ""
814 "مساحة اسم المستخدم الأولية ليس لها مساحة اسم أم، لكن، من أجل الاتساق، توفر "
815 "النواة ملفات تعيين معرف مستخدم ومجموعة وهمية لهذه المساحة. النظر إلى ملف "
816 "I<uid_map> (I<gid_map> هو نفسه) من شل في المساحة الأولية يُظهر:"
817
818 #. type: Plain text
819 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
820 #: opensuse-tumbleweed
821 #, no-wrap
822 msgid ""
823 "$B< cat /proc/$$/uid_map>;\n"
824 " 0 0 4294967295\n"
825 msgstr ""
826 "$B< cat /proc/$$/uid_map>;\n"
827 " 0 0 4294967295\n"
828
829 #. ============================================================
830 #. type: Plain text
831 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
832 #: opensuse-leap-16-1 opensuse-tumbleweed
833 #| msgid ""
834 #| "This mapping tells us that the range starting at user ID 0 in this "
835 #| "namespace maps to a range starting at 0 in the (nonexistent) parent "
836 #| "namespace, and the size of the range is the largest 32-bit unsigned "
837 #| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. "
838 #| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., "
839 #| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving "
840 #| "I<(uid_t)\\~-1> unmapped and unusable guarantees that there will be no "
841 #| "confusion when using these interfaces."
842 msgid ""
843 "This mapping tells us that the range starting at user ID 0 in this namespace "
844 "maps to a range starting at 0 in the (nonexistent) parent namespace, and the "
845 "size of the range is the largest 32-bit unsigned integer. This leaves "
846 "4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: "
847 "I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a "
848 "way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and "
849 "unusable guarantees that there will be no confusion when using these "
850 "interfaces."
851 msgstr ""
852 "يخبرنا هذا التعيين أن النطاق الذي يبدأ بمعرف المستخدم 0 في هذا النطاق الاسمي "
853 "يُعيّن إلى نطاق يبدأ بـ 0 في النطاق الاسمي الأصلي (غير الموجود)، وحجم النطاق "
854 "هو أكبر عدد صحيح غير موقّع 32 بت. هذا يترك 4294967295 (القيمة -1 الموقّعة 32 "
855 "بت) غير معيّنة. هذا متعمد: I<(uid_t)\\ -1> يُستخدم في عدة واجهات (مثل "
856 "B<setreuid>(2)) كطريقة لتحديد \"لا يوجد معرف مستخدم\". ترك I<(uid_t)\\ -1> "
857 "غير معيّنة وغير قابلة للاستخدام يضمن عدم حدوث ارتباك عند استخدام هذه الواجهات."
858
859 #. type: SS
860 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
861 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
862 #, no-wrap
863 msgid "Defining user and group ID mappings: writing to uid_map and gid_map"
864 msgstr "تعريف تعيينات معرف المستخدم والمجموعة: الكتابة إلى uid_map و gid_map"
865
866 #. type: Plain text
867 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
868 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
869 msgid ""
870 "After the creation of a new user namespace, the I<uid_map> file of I<one> of "
871 "the processes in the namespace may be written to I<once> to define the "
872 "mapping of user IDs in the new user namespace. An attempt to write more "
873 "than once to a I<uid_map> file in a user namespace fails with the error "
874 "B<EPERM>. Similar rules apply for I<gid_map> files."
875 msgstr ""
876 "بعد إنشاء نطاق اسمي جديد للمستخدم، يمكن الكتابة إلى ملف I<uid_map> الخاص بـ "
877 "I<واحد> من العمليات في النطاق الاسمي I<مرة واحدة> لتعريف تعيين معرفات "
878 "المستخدم في النطاق الاسمي الجديد للمستخدم. أي محاولة للكتابة أكثر من مرة "
879 "إلى ملف I<uid_map> في نطاق اسمي للمستخدم تفشل مع الخطأ B<EPERM>. تنطبق "
880 "قواعد مماثلة على ملفات I<gid_map>."
881
882 #. type: Plain text
883 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
884 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
885 msgid ""
886 "The lines written to I<uid_map> (I<gid_map>) must conform to the following "
887 "validity rules:"
888 msgstr ""
889 "يجب أن تتوافق الأسطر المكتوبة إلى I<uid_map> (I<gid_map>) مع قواعد الصلاحية "
890 "التالية:"
891
892 #. type: Plain text
893 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
894 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
895 msgid ""
896 "The three fields must be valid numbers, and the last field must be greater "
897 "than 0."
898 msgstr ""
899 "يجب أن تكون الحقول الثلاثة أرقامًا صالحة، ويجب أن يكون الحقل الأخير أكبر من 0."
900
901 #. type: Plain text
902 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
903 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
904 msgid "Lines are terminated by newline characters."
905 msgstr "تُنهى الأسطر بأحرف السطر الجديد."
906
907 #. 5*12-byte records could fit in a 64B cache line
908 #. commit 6397fac4915ab3002dc15aae751455da1a852f25
909 #. type: Plain text
910 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
911 #: opensuse-tumbleweed
912 msgid ""
913 "There is a limit on the number of lines in the file. Up to Linux 4.14, this "
914 "limit was (arbitrarily) set at 5 lines. Since Linux 4.16, the limit is 340 "
915 "lines. In addition, the number of bytes written to the file must be less "
916 "than the system page size, and the write must be performed at the start of "
917 "the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used to write to "
918 "nonzero offsets in the file)."
919 msgstr ""
920 "يوجد حد لعدد الأسطر في الملف. حتى لينكس 4.14، كان هذا الحد (بشكل تعسفي) "
921 "مضبوطًا على 5 أسطر. منذ لينكس 4.16، أصبح الحد 340 سطرًا. بالإضافة إلى ذلك، "
922 "يجب أن يكون عدد البايتات المكتوبة إلى الملف أقل من حجم صفحة النظام، ويجب "
923 "إجراء الكتابة في بداية الملف (أي لا يمكن استخدام B<lseek>(2) و B<pwrite>(2) "
924 "للكتابة إلى إزاحات غير صفرية في الملف)."
925
926 #. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba
927 #. type: Plain text
928 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
929 #: opensuse-tumbleweed
930 msgid ""
931 "The range of user IDs (group IDs) specified in each line cannot overlap "
932 "with the ranges in any other lines. In the initial implementation (Linux "
933 "3.8), this requirement was satisfied by a simplistic implementation that "
934 "imposed the further requirement that the values in both field 1 and field 2 "
935 "of successive lines must be in ascending numerical order, which prevented "
936 "some otherwise valid maps from being created. Since Linux 3.9, this "
937 "limitation has been removed, allowing any valid set of nonoverlapping maps."
938 msgstr ""
939 "لا يمكن أن يتداخل نطاق معرفات المستخدم (معرفات المجموعة) المحدد في كل سطر مع "
940 "النطاقات في أي أسطر أخرى. في التطبيق الأولي (لينكس 3.8)، تم تلبية هذا "
941 "المطلب من خلال تطبيق مبسط فرض مطلبًا إضافيًا بأن القيم في كل من الحقل 1"
942 " والحقل "
943 "2 من الأسطر المتتالية يجب أن تكون بترتيب تصاعدي عددي، مما منع إنشاء بعض "
944 "الخرائط الصالحة بخلاف ذلك. منذ لينكس 3.9، تمت إزالة هذا القيد، مما يسمح بأي "
945 "مجموعة صالحة من الخرائط غير المتداخلة."
946
947 #. type: Plain text
948 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
949 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
950 msgid "At least one line must be written to the file."
951 msgstr "يجب كتابة سطر واحد على الأقل إلى الملف."
952
953 #. type: Plain text
954 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
955 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
956 msgid "Writes that violate the above rules fail with the error B<EINVAL>."
957 msgstr ""
958 "تفشل عمليات الكتابة التي تخالف القواعد المذكورة أعلاه مع الخطأ B<EINVAL>."
959
960 #. type: Plain text
961 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
962 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
963 msgid ""
964 "In order for a process to write to the I</proc/>pidI</uid_map> (I</proc/"
965 ">pidI</gid_map>) file, all of the following permission requirements must be "
966 "met:"
967 msgstr ""
968 "لكي تتمكن عملية من الكتابة إلى ملف I</proc/>pidI</uid_map> (I</proc/>pidI</"
969 "gid_map>)، يجب استيفاء جميع متطلبات الإذن التالية:"
970
971 #. type: Plain text
972 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
973 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
974 msgid ""
975 "The writing process must have the B<CAP_SETUID> (B<CAP_SETGID>) capability "
976 "in the user namespace of the process I<pid>."
977 msgstr ""
978 "يجب أن تمتلك عملية الكتابة القدرة B<CAP_SETUID> (B<CAP_SETGID>) في النطاق "
979 "الاسمي للمستخدم للعملية I<pid>."
980
981 #. type: Plain text
982 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
983 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
984 msgid ""
985 "The writing process must either be in the user namespace of the process "
986 "I<pid> or be in the parent user namespace of the process I<pid>."
987 msgstr ""
988 "يجب أن تكون عملية الكتابة إما في النطاق الاسمي للمستخدم للعملية I<pid> أو في "
989 "النطاق الاسمي للمستخدم الأصلي للعملية I<pid>."
990
991 #. type: Plain text
992 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
993 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
994 msgid ""
995 "The mapped user IDs (group IDs) must in turn have a mapping in the parent "
996 "user namespace."
997 msgstr ""
998 "يجب أن يكون لمعرفات المستخدم (معرفات المجموعة) المعيّنة بدورها تعيين في "
999 "النطاق الاسمي للمستخدم الأصلي."
1000
1001 #. type: Plain text
1002 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1003 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1004 msgid ""
1005 "If updating I</proc/>pidI</uid_map> to create a mapping that maps UID 0 in "
1006 "the parent namespace, then one of the following must be true:"
1007 msgstr ""
1008 "إذا تم تحديث I</proc/>pidI</uid_map> لإنشاء تعيين يُعيّن UID 0 في النطاق "
1009 "الاسمي الأصلي، فيجب أن يكون أحد ما يلي صحيحًا:"
1010
1011 #. type: Plain text
1012 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1013 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1014 msgid ""
1015 "if writing process is in the parent user namespace, then it must have the "
1016 "B<CAP_SETFCAP> capability in that user namespace; or"
1017 msgstr ""
1018 "إذا كانت عملية الكتابة في النطاق الاسمي للمستخدم الأصلي، فيجب أن تمتلك "
1019 "القدرة B<CAP_SETFCAP> في ذلك النطاق الاسمي للمستخدم؛ أو"
1020
1021 #. type: Plain text
1022 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1023 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1024 msgid ""
1025 "if the writing process is in the child user namespace, then the process that "
1026 "created the user namespace must have had the B<CAP_SETFCAP> capability when "
1027 "the namespace was created."
1028 msgstr ""
1029 "إذا كانت عملية الكتابة في النطاق الاسمي للمستخدم الفرعي، فيجب أن تكون "
1030 "العملية التي أنشأت النطاق الاسمي للمستخدم قد امتلكت القدرة B<CAP_SETFCAP> "
1031 "عند إنشاء النطاق الاسمي."
1032
1033 #. commit db2e718a47984b9d71ed890eb2ea36ecf150de18
1034 #. type: Plain text
1035 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1036 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1037 msgid ""
1038 "This rule has been in place since Linux 5.12. It eliminates an earlier "
1039 "security bug whereby a UID 0 process that lacks the B<CAP_SETFCAP> "
1040 "capability, which is needed to create a binary with namespaced file "
1041 "capabilities (as described in B<capabilities>(7)), could nevertheless create "
1042 "such a binary, by the following steps:"
1043 msgstr ""
1044 "هذه القاعدة سارية منذ لينكس 5.12. إنها تزيل خطأ أمني سابق حيث يمكن لعملية "
1045 "UID 0 التي تفتقر إلى القدرة B<CAP_SETFCAP>، اللازمة لإنشاء ملف ثنائي بقدرات "
1046 "ملفات ذات نطاق اسمي (كما هو موصوف في B<capabilities>(7))، مع ذلك إنشاء مثل "
1047 "هذا الملف الثنائي، من خلال الخطوات التالية:"
1048
1049 #. type: Plain text
1050 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1051 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1052 msgid ""
1053 "Create a new user namespace with the identity mapping (i.e., UID 0 in the "
1054 "new user namespace maps to UID 0 in the parent namespace), so that UID 0 in "
1055 "both namespaces is equivalent to the same root user ID."
1056 msgstr ""
1057 "إنشاء نطاق اسمي جديد للمستخدم مع تعيين الهوية (أي UID 0 في النطاق الاسمي "
1058 "الجديد للمستخدم يُعيّن إلى UID 0 في النطاق الاسمي الأصلي)، بحيث يكون UID 0 في "
1059 "كلا النطاقين الاسميين مكافئًا لنفس معرف المستخدم الجذر."
1060
1061 #. type: Plain text
1062 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1063 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1064 msgid ""
1065 "Since the child process has the B<CAP_SETFCAP> capability, it could create a "
1066 "binary with namespaced file capabilities that would then be effective in the "
1067 "parent user namespace (because the root user IDs are the same in the two "
1068 "namespaces)."
1069 msgstr ""
1070 "نظرًا لأن العملية الفرعية تمتلك القدرة B<CAP_SETFCAP>، يمكنها إنشاء ملف ثنائي "
1071 "بقدرات ملفات ذات نطاق اسمي والتي ستكون فعالة بعد ذلك في النطاق الاسمي "
1072 "للمستخدم الأصلي (لأن معرفات المستخدم الجذر هي نفسها في النطاقين الاسميين)."
1073
1074 #. type: Plain text
1075 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1076 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1077 msgid "One of the following two cases applies:"
1078 msgstr "ينطبق أحد الحالتين التاليتين:"
1079
1080 #. type: Plain text
1081 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1082 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1083 msgid ""
1084 "I<Either> the writing process has the B<CAP_SETUID> (B<CAP_SETGID>) "
1085 "capability in the I<parent> user namespace."
1086 msgstr ""
1087 "I<إما> أن تمتلك عملية الكتابة القدرة B<CAP_SETUID> (B<CAP_SETGID>) في النطاق "
1088 "الاسمي للمستخدم I<الأصلي>."
1089
1090 #. type: Plain text
1091 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1092 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1093 msgid ""
1094 "No further restrictions apply: the process can make mappings to arbitrary "
1095 "user IDs (group IDs) in the parent user namespace."
1096 msgstr ""
1097 "لا تنطبق قيود إضافية: يمكن للعملية إجراء تعيينات لمعرفات مستخدم (معرفات "
1098 "مجموعة) عشوائية في النطاق الاسمي للمستخدم الأصلي."
1099
1100 #. type: Plain text
1101 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1102 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1103 msgid "I<Or> otherwise all of the following restrictions apply:"
1104 msgstr "I<أو> بخلاف ذلك تنطبق جميع القيود التالية:"
1105
1106 #. type: Plain text
1107 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1108 #: opensuse-tumbleweed
1109 msgid ""
1110 "The data written to I<uid_map> (I<gid_map>) must consist of a single line "
1111 "that maps the writing process's effective user ID (group ID) in the parent "
1112 "user namespace to a user ID (group ID) in the user namespace."
1113 msgstr ""
1114 "يجب أن تتكون البيانات المكتوبة إلى I<uid_map> (I<gid_map>) من سطر واحد يُعيّن "
1115 "معرف المستخدم الفعال (معرف المجموعة) لعملية الكتابة في النطاق الاسمي "
1116 "للمستخدم الأصلي إلى معرف مستخدم (معرف مجموعة) في النطاق الاسمي للمستخدم."
1117
1118 #. type: Plain text
1119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1121 msgid ""
1122 "The writing process must have the same effective user ID as the process that "
1123 "created the user namespace."
1124 msgstr ""
1125 "يجب أن تمتلك عملية الكتابة نفس معرف المستخدم الفعال لعملية أنشأت مساحة اسم "
1126 "المستخدم."
1127
1128 #. type: Plain text
1129 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1130 #: opensuse-tumbleweed
1131 msgid ""
1132 "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
1133 "first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</"
1134 "setgroups> file (see below) before writing to I<gid_map>."
1135 msgstr ""
1136 "في حالة I<gid_map>، يجب أولاً رفض استخدام استدعاء النظام B<setgroups>(2) "
1137 "بكتابة \\[dq]I<deny>\\[dq] إلى ملف I</proc/>pidI</setgroups> (انظر أدناه) "
1138 "قبل الكتابة إلى I<gid_map>."
1139
1140 #
1141 #. ============================================================
1142 #. type: Plain text
1143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1145 msgid "Writes that violate the above rules fail with the error B<EPERM>."
1146 msgstr "تفشل عمليات الكتابة التي تخالف القواعد أعلاه مع الخطأ B<EPERM>."
1147
1148 #. type: SS
1149 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1150 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1151 #, no-wrap
1152 msgid "Project ID mappings: projid_map"
1153 msgstr "تعيينات معرف المشروع: projid_map"
1154
1155 #. type: Plain text
1156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1158 msgid ""
1159 "Similarly to user and group ID mappings, it is possible to create project ID "
1160 "mappings for a user namespace. (Project IDs are used for disk quotas; see "
1161 "B<setquota>(8) and B<quotactl>(2).)"
1162 msgstr ""
1163 "على غرار تعيينات معرف المستخدم والمجموعة، من الممكن إنشاء تعيينات معرف مشروع "
1164 "لمساحة اسم المستخدم. (تُستخدم معرفات المشروع لحصص القرص؛ انظر B<setquota>(8) "
1165 "وB<quotactl>(2).)"
1166
1167 #. commit f76d207a66c3a53defea67e7d36c3eb1b7d6d61d
1168 #. type: Plain text
1169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1171 msgid ""
1172 "Project ID mappings are defined by writing to the I</proc/>pidI</projid_map> "
1173 "file (present since Linux 3.7)."
1174 msgstr ""
1175 "تُعرّف تعيينات معرف المشروع بالكتابة إلى ملف I</proc/>pidI</projid_map>"
1176 " (موجود "
1177 "منذ Linux 3.7)."
1178
1179 #. type: Plain text
1180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1182 msgid ""
1183 "The validity rules for writing to the I</proc/>pidI</projid_map> file are as "
1184 "for writing to the I<uid_map> file; violation of these rules causes "
1185 "B<write>(2) to fail with the error B<EINVAL>."
1186 msgstr ""
1187 "قواعد الصلاحية للكتابة إلى ملف I</proc/>pidI</projid_map> هي نفسها للكتابة "
1188 "إلى ملف I<uid_map>؛ يؤدي انتهاك هذه القواعد إلى فشل B<write>(2) مع الخطأ "
1189 "B<EINVAL>."
1190
1191 #. type: Plain text
1192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1194 msgid ""
1195 "The permission rules for writing to the I</proc/>pidI</projid_map> file are "
1196 "as follows:"
1197 msgstr "قواعد الإذن للكتابة إلى ملف I</proc/>pidI</projid_map> هي كما يلي:"
1198
1199 #. type: Plain text
1200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1202 msgid ""
1203 "The mapped project IDs must in turn have a mapping in the parent user "
1204 "namespace."
1205 msgstr ""
1206 "يجب أن تمتلك معرفات المشروع المعيّنة بدورها تعيينًا في مساحة اسم المستخدم "
1207 "الأصل."
1208
1209 #
1210 #. ============================================================
1211 #. type: Plain text
1212 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1213 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1214 msgid ""
1215 "Violation of these rules causes B<write>(2) to fail with the error B<EPERM>."
1216 msgstr "يؤدي انتهاك هذه القواعد إلى فشل B<write>(2) مع الخطأ B<EPERM>."
1217
1218 #. type: SS
1219 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1220 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1221 #, no-wrap
1222 msgid "Interaction with system calls that change process UIDs or GIDs"
1223 msgstr ""
1224 "التفاعل مع استدعاءات النظام التي تغير معرفات المستخدم أو معرفات المجموعة"
1225 " للعملية"
1226
1227 #. type: Plain text
1228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1230 msgid ""
1231 "In a user namespace where the I<uid_map> file has not been written, the "
1232 "system calls that change user IDs will fail. Similarly, if the I<gid_map> "
1233 "file has not been written, the system calls that change group IDs will "
1234 "fail. After the I<uid_map> and I<gid_map> files have been written, only the "
1235 "mapped values may be used in system calls that change user and group IDs."
1236 msgstr ""
1237 "في مساحة اسم المستخدم حيث لم يُكتب ملف I<uid_map>، ستفشل استدعاءات النظام "
1238 "التي تغير معرفات المستخدم. وبالمثل، إذا لم يُكتب ملف I<gid_map>، ستفشل "
1239 "استدعاءات النظام التي تغير معرفات المجموعة. بعد كتابة ملفي I<uid_map> "
1240 "وI<gid_map>، يمكن استخدام القيم المعيّنة فقط في استدعاءات النظام التي تغير "
1241 "معرفات المستخدم والمجموعة."
1242
1243 #. type: Plain text
1244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1246 msgid ""
1247 "For user IDs, the relevant system calls include B<setuid>(2), "
1248 "B<setfsuid>(2), B<setreuid>(2), and B<setresuid>(2). For group IDs, the "
1249 "relevant system calls include B<setgid>(2), B<setfsgid>(2), B<setregid>(2), "
1250 "B<setresgid>(2), and B<setgroups>(2)."
1251 msgstr ""
1252 "لمعرفات المستخدم، تتضمن استدعاءات النظام ذات الصلة B<setuid>(2) "
1253 "وB<setfsuid>(2) وB<setreuid>(2) وB<setresuid>(2). ولمعرفات المجموعة، تتضمن "
1254 "استدعاءات النظام ذات الصلة B<setgid>(2) وB<setfsgid>(2) وB<setregid>(2) "
1255 "وB<setresgid>(2) وB<setgroups>(2)."
1256
1257 #
1258 #. Things changed in Linux 3.19
1259 #. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8
1260 #. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272
1261 #. http://lwn.net/Articles/626665/
1262 #. ============================================================
1263 #. type: Plain text
1264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1266 msgid ""
1267 "Writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</setgroups> file before "
1268 "writing to I</proc/>pidI</gid_map> will permanently disable B<setgroups>(2) "
1269 "in a user namespace and allow writing to I</proc/>pidI</gid_map> without "
1270 "having the B<CAP_SETGID> capability in the parent user namespace."
1271 msgstr ""
1272 "كتابة \\[dq]I<deny>\\[dq] إلى ملف I</proc/>pidI</setgroups> قبل الكتابة إلى "
1273 "I</proc/>pidI</gid_map> ستعطل B<setgroups>(2) بشكل دائم في مساحة اسم "
1274 "المستخدم وتسمح بالكتابة إلى I</proc/>pidI</gid_map> دون امتلاك القدرة "
1275 "B<CAP_SETGID> في مساحة اسم المستخدم الأصل."
1276
1277 #. type: SS
1278 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1279 #: opensuse-tumbleweed
1280 #, no-wrap
1281 msgid "The \\f[I]/proc/\\fBpid\\f[I]/setgroups\\fB file"
1282 msgstr "ملف \\f[I]/proc/\\fBpid\\f[I]/setgroups\\fB"
1283
1284 #
1285 #. commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8
1286 #. commit 66d2f338ee4c449396b6f99f5e75cd18eb6df272
1287 #. http://lwn.net/Articles/626665/
1288 #. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-8989
1289 #. type: Plain text
1290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1292 msgid ""
1293 "The I</proc/>pidI</setgroups> file displays the string \\[dq]I<allow>\\[dq] "
1294 "if processes in the user namespace that contains the process I<pid> are "
1295 "permitted to employ the B<setgroups>(2) system call; it displays "
1296 "\\[dq]I<deny>\\[dq] if B<setgroups>(2) is not permitted in that user "
1297 "namespace. Note that regardless of the value in the I</proc/>pidI</"
1298 "setgroups> file (and regardless of the process's capabilities), calls to "
1299 "B<setgroups>(2) are also not permitted if I</proc/>pidI</gid_map> has not "
1300 "yet been set."
1301 msgstr ""
1302 "يعرض ملف I</proc/>pidI</setgroups> السلسلة \\[dq]I<allow>\\[dq] إذا سُمح "
1303 "للعمليات في مساحة اسم المستخدم التي تحتوي على العملية I<pid> باستخدام "
1304 "استدعاء النظام B<setgroups>(2)؛ ويعرض \\[dq]I<deny>\\[dq] إذا لم يُسمح بـ "
1305 "B<setgroups>(2) في مساحة اسم المستخدم تلك. لاحظ أنه بغض النظر عن القيمة في "
1306 "ملف I</proc/>pidI</setgroups> (وبغض النظر عن قدرات العملية)، لا يُسمح أيضًا "
1307 "باستدعاءات B<setgroups>(2) إذا لم يُعيّن I</proc/>pidI</gid_map> بعد."
1308
1309 #. type: Plain text
1310 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1311 #: opensuse-tumbleweed
1312 msgid ""
1313 "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
1314 "namespace) may write either of the strings \\[dq]I<allow>\\[dq] or "
1315 "\\[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for "
1316 "this user namespace to the file I</proc/>pidI</gid_map>. Writing the string "
1317 "\\[dq]I<deny>\\[dq] prevents any process in the user namespace from "
1318 "employing B<setgroups>(2)."
1319 msgstr ""
1320 "يمكن لعملية متميزة (تلك التي تمتلك القدرة B<CAP_SYS_ADMIN> في مساحة الاسم) "
1321 "كتابة أي من السلسلتين \\[dq]I<allow>\\[dq] أو \\[dq]I<deny>\\[dq] إلى هذا "
1322 "الملف I<قبل> كتابة تعيين معرف مجموعة لمساحة اسم المستخدم هذه إلى ملف I</proc/"
1323 ">pidI</gid_map>. تمنع كتابة السلسلة \\[dq]I<deny>\\[dq] أي عملية في مساحة "
1324 "اسم المستخدم من استخدام B<setgroups>(2)."
1325
1326 #. type: Plain text
1327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1329 msgid ""
1330 "The essence of the restrictions described in the preceding paragraph is that "
1331 "it is permitted to write to I</proc/>pidI</setgroups> only so long as "
1332 "calling B<setgroups>(2) is disallowed because I</proc/>pidI</gid_map> has "
1333 "not been set. This ensures that a process cannot transition from a state "
1334 "where B<setgroups>(2) is allowed to a state where B<setgroups>(2) is "
1335 "denied; a process can transition only from B<setgroups>(2) being disallowed "
1336 "to B<setgroups>(2) being allowed."
1337 msgstr ""
1338 "جوهر القيود الموصوفة في الفقرة السابقة هو أنه يُسمح بالكتابة إلى I</proc/"
1339 ">pidI</setgroups> فقط طالما أن استدعاء B<setgroups>(2) غير مسموح به لأن I</"
1340 "proc/>pidI</gid_map> لم يُعيّن. يضمن هذا ألا تستطيع العملية الانتقال من حالة "
1341 "يُسمح فيها بـ B<setgroups>(2) إلى حالة يُرفض فيها B<setgroups>(2)؛ يمكن "
1342 "للعملية الانتقال فقط من حالة عدم السماح بـ B<setgroups>(2) إلى حالة السماح "
1343 "بـ B<setgroups>(2)."
1344
1345 #. type: Plain text
1346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1348 msgid ""
1349 "The default value of this file in the initial user namespace is "
1350 "\\[dq]I<allow>\\[dq]."
1351 msgstr ""
1352 "القيمة المبدئية لهذا الملف في مساحة اسم المستخدم الأولية هي "
1353 "\\[dq]I<allow>\\[dq]."
1354
1355 #. type: Plain text
1356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1358 msgid ""
1359 "Once I</proc/>pidI</gid_map> has been written to (which has the effect of "
1360 "enabling B<setgroups>(2) in the user namespace), it is no longer possible "
1361 "to disallow B<setgroups>(2) by writing \\[dq]I<deny>\\[dq] to I</proc/"
1362 ">pidI</setgroups> (the write fails with the error B<EPERM>)."
1363 msgstr ""
1364 "بمجرد الكتابة إلى I</proc/>pidI</gid_map> (والذي له تأثير تمكين "
1365 "B<setgroups>(2) في مساحة اسم المستخدم)، لم يعد من الممكن منع B<setgroups>(2) "
1366 "بكتابة \\[dq]I<deny>\\[dq] إلى I</proc/>pidI</setgroups> (تفشل الكتابة مع "
1367 "الخطأ B<EPERM>)."
1368
1369 #. type: Plain text
1370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1372 msgid ""
1373 "A child user namespace inherits the I</proc/>pidI</setgroups> setting from "
1374 "its parent."
1375 msgstr ""
1376 "ترث مساحة اسم المستخدم الفرعية إعداد I</proc/>pidI</setgroups> من أصلها."
1377
1378 #. type: Plain text
1379 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1380 #: opensuse-tumbleweed
1381 msgid ""
1382 "If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the "
1383 "B<setgroups>(2) system call can't subsequently be reenabled (by writing "
1384 "\\[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do "
1385 "so fail with the error B<EPERM>.) This restriction also propagates down to "
1386 "all child user namespaces of this user namespace."
1387 msgstr ""
1388 "إذا كان ملف I<setgroups> يحتوي على القيمة \\[dq]I<deny>\\[dq]، فلا يمكن "
1389 "إعادة تمكين استدعاء النظام B<setgroups>(2) لاحقًا (بكتابة "
1390 "\\[dq]I<allow>\\[dq] إلى الملف) في مساحة اسم المستخدم هذه. (تفشل محاولات "
1391 "القيام بذلك مع الخطأ B<EPERM>.) ينتشر هذا القيد أيضًا إلى جميع مساحات اسم "
1392 "المستخدم الفرعية لمساحة اسم المستخدم هذه."
1393
1394 #
1395 #
1396 #
1397 #
1398 #. /proc/PID/setgroups
1399 #. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed]
1400 #. * Can write if have CAP_SYS_ADMIN in NS
1401 #. * Must write BEFORE writing to /proc/PID/gid_map
1402 #. setgroups()
1403 #. * Must already have written to gid_map
1404 #. * /proc/PID/setgroups must be "allow"
1405 #. /proc/PID/gid_map -- writing
1406 #. * Must already have written "deny" to /proc/PID/setgroups
1407 #. ============================================================
1408 #. type: Plain text
1409 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1410 #: opensuse-tumbleweed
1411 msgid ""
1412 "The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was "
1413 "backported to many earlier stable kernel series, because it addresses a "
1414 "security issue. The issue concerned files with permissions such as \"rwx---"
1415 "rwx\". Such files give fewer permissions to \"group\" than they do to "
1416 "\"other\". This means that dropping groups using B<setgroups>(2) might "
1417 "allow a process file access that it did not formerly have. Before the "
1418 "existence of user namespaces this was not a concern, since only a privileged "
1419 "process (one with the B<CAP_SETGID> capability) could call "
1420 "B<setgroups>(2). However, with the introduction of user namespaces, it "
1421 "became possible for an unprivileged process to create a new namespace in "
1422 "which the user had all privileges. This then allowed formerly unprivileged "
1423 "users to drop groups and thus gain file access that they did not previously "
1424 "have. The I</proc/>pidI</setgroups> file was added to address this security "
1425 "issue, by denying any pathway for an unprivileged process to drop groups "
1426 "with B<setgroups>(2)."
1427 msgstr ""
1428 "أُضيف ملف I</proc/>pidI</setgroups> في Linux 3.19، لكنه نُقل إلى العديد من "
1429 "سلاسل النواة المستقرة السابقة، لأنه يعالج مشكلة أمنية. تعلقت المشكلة "
1430 "بالملفات ذات الأذونات مثل \"rwx---rwx\". تمنح هذه الملفات أذونات أقل لـ "
1431 "\"group\" مقارنة بـ \"other\". يعني هذا أن إسقاط المجموعات باستخدام "
1432 "B<setgroups>(2) قد يسمح لعملية بالوصول إلى ملف لم يكن لديها سابقًا. قبل وجود "
1433 "مساحات اسم المستخدم، لم يكن هذا مصدر قلق، لأن عملية متميزة فقط (تلك التي "
1434 "تمتلك القدرة B<CAP_SETGID>) يمكنها استدعاء B<setgroups>(2). ومع ذلك، مع "
1435 "إدخال مساحات اسم المستخدم، أصبح من الممكن لعملية غير متميزة إنشاء مساحة اسم "
1436 "جديدة يمتلك فيها المستخدم جميع الامتيازات. سمح هذا بعد ذلك للمستخدمين غير "
1437 "المتميزين سابقًا بإسقاط المجموعات وبالتالي الحصول على وصول إلى ملفات لم "
1438 "يمتلكوها سابقًا. أُضيف ملف I</proc/>pidI</setgroups> لمعالجة هذه المشكلة "
1439 "الأمنية، برفض أي مسار لعملية غير متميزة لإسقاط المجموعات باستخدام "
1440 "B<setgroups>(2)."
1441
1442 #. type: SS
1443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1445 #, no-wrap
1446 msgid "Unmapped user and group IDs"
1447 msgstr "معرفات المستخدم والمجموعة غير المعيّنة"
1448
1449 #. from_kuid_munged(), from_kgid_munged()
1450 #. type: Plain text
1451 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1452 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1453 msgid ""
1454 "There are various places where an unmapped user ID (group ID) may be "
1455 "exposed to user space. For example, the first process in a new user "
1456 "namespace may call B<getuid>(2) before a user ID mapping has been defined "
1457 "for the namespace. In most such cases, an unmapped user ID is converted to "
1458 "the overflow user ID (group ID); the default value for the overflow user ID "
1459 "(group ID) is 65534. See the descriptions of I</proc/sys/kernel/"
1460 "overflowuid> and I</proc/sys/kernel/overflowgid> in B<proc>(5)."
1461 msgstr ""
1462 "توجد أماكن مختلفة قد يُعرض فيها معرف مستخدم غير معيّن (معرف مجموعة) إلى مساحة "
1463 "المستخدم. على سبيل المثال، قد تستدعي العملية الأولى في مساحة اسم مستخدم "
1464 "جديدة B<getuid>(2) قبل تعريف تعيين معرف مستخدم لمساحة الاسم. في معظم هذه "
1465 "الحالات، يُحوّل معرف المستخدم غير المعيّن إلى معرف المستخدم الفائض (معرف "
1466 "المجموعة)؛ القيمة المبدئية لمعرف المستخدم الفائض (معرف المجموعة) هي 65534. "
1467 "انظر أوصاف I</proc/sys/kernel/overflowuid> وI</proc/sys/kernel/overflowgid> "
1468 "في B<proc>(5)."
1469
1470 #. also SO_PEERCRED
1471 #. type: Plain text
1472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1474 msgid ""
1475 "The cases where unmapped IDs are mapped in this fashion include system calls "
1476 "that return user IDs (B<getuid>(2), B<getgid>(2), and similar), credentials "
1477 "passed over a UNIX domain socket, credentials returned by B<stat>(2), "
1478 "B<waitid>(2), and the System V IPC \"ctl\" B<IPC_STAT> operations, "
1479 "credentials exposed by I</proc/>pidI</status> and the files in I</proc/"
1480 "sysvipc/*>, credentials returned via the I<si_uid> field in the I<siginfo_t> "
1481 "received with a signal (see B<sigaction>(2)), credentials written to the "
1482 "process accounting file (see B<acct>(5)), and credentials returned with "
1483 "POSIX message queue notifications (see B<mq_notify>(3))."
1484 msgstr ""
1485 "الحالات التي تُرسم فيها المعرفات غير المُعيّنة بهذه الطريقة تشمل استدعاءات "
1486 "النظام التي تُرجع معرفات المستخدم (B<getuid>(2)، B<getgid>(2) وما شابه)، "
1487 "بيانات الاعتماد المُمرّرة عبر مقبس نطاق UNIX، بيانات الاعتماد المُعادة بواسطة "
1488 "B<stat>(2)، B<waitid>(2)، وعمليات \"ctl\" B<IPC_STAT> لنظام V IPC، بيانات "
1489 "الاعتماد المُكشوفة بواسطة I</proc/>pidI</status> والملفات في I</proc/sysvipc/"
1490 "*>، بيانات الاعتماد المُعادة عبر حقل I<si_uid> في I<siginfo_t> المُستقبَل مع "
1491 "إشارة (انظر B<sigaction>(2))، بيانات الاعتماد المُكتوبة في ملف محاسبة العملية "
1492 "(انظر B<acct>(5))، وبيانات الاعتماد المُعادة مع إشعارات قائمة انتظار رسائل "
1493 "POSIX (انظر B<mq_notify>(3))."
1494
1495 #
1496 #. from_kuid(), from_kgid()
1497 #. Also F_GETOWNER_UIDS is an exception
1498 #. ============================================================
1499 #. type: Plain text
1500 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1501 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1502 msgid ""
1503 "There is one notable case where unmapped user and group IDs are I<not> "
1504 "converted to the corresponding overflow ID value. When viewing a I<uid_map> "
1505 "or I<gid_map> file in which there is no mapping for the second field, that "
1506 "field is displayed as 4294967295 (-1 as an unsigned integer)."
1507 msgstr ""
1508 "هناك حالة بارزة واحدة حيث لا تُحوّل معرفات المستخدم والمجموعة غير المُعيّنة"
1509 " إلى "
1510 "قيمة معرف الفائض المقابلة. عند عرض ملف I<uid_map> أو I<gid_map> الذي لا يوجد "
1511 "فيه رسم للحقل الثاني، يُعرض ذلك الحقل كـ 4294967295 (-1 كعدد صحيح غير مُوقّع)."
1512
1513 #. type: SS
1514 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1515 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1516 #, no-wrap
1517 msgid "Accessing files"
1518 msgstr "الوصول إلى الملفات"
1519
1520 #
1521 #. ============================================================
1522 #. type: Plain text
1523 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1524 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1525 msgid ""
1526 "In order to determine permissions when an unprivileged process accesses a "
1527 "file, the process credentials (UID, GID) and the file credentials are in "
1528 "effect mapped back to what they would be in the initial user namespace and "
1529 "then compared to determine the permissions that the process has on the "
1530 "file. The same is also true of other objects that employ the credentials "
1531 "plus permissions mask accessibility model, such as System V IPC objects."
1532 msgstr ""
1533 "لتحديد الأذونات عندما يصل عملية غير مُمتازة إلى ملف، تُرسم بيانات اعتماد "
1534 "العملية (UID، GID) وبيانات اعتماد الملف فعليًا إلى ما ستكون عليه في مساحة "
1535 "المستخدم الأولية ثم تُقارَن لتحديد الأذونات التي تمتلكها العملية على الملف. "
1536 "ينطبق الشيء نفسه على الكائنات الأخرى التي تستخدم نموذج الوصول لبيانات "
1537 "الاعتماد بالإضافة إلى قناع الأذونات، مثل كائنات System V IPC."
1538
1539 #. type: SS
1540 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1541 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1542 #, no-wrap
1543 msgid "Operation of file-related capabilities"
1544 msgstr "تشغيل القدرات المتعلقة بالملفات"
1545
1546 #. type: Plain text
1547 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1548 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1549 msgid ""
1550 "Certain capabilities allow a process to bypass various kernel-enforced "
1551 "restrictions when performing operations on files owned by other users or "
1552 "groups. These capabilities are: B<CAP_CHOWN>, B<CAP_DAC_OVERRIDE>, "
1553 "B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER>, and B<CAP_FSETID>."
1554 msgstr ""
1555 "تسمح قدرات معينة لعملية بتجاوز قيود مختلفة يُفرضها النواة عند تنفيذ عمليات "
1556 "على ملفات مملوكة لمستخدمين أو مجموعات أخرى. هذه القدرات هي: B<CAP_CHOWN>، "
1557 "B<CAP_DAC_OVERRIDE>، B<CAP_DAC_READ_SEARCH>، B<CAP_FOWNER>، و B<CAP_FSETID>."
1558
1559 #. type: Plain text
1560 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1561 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1562 msgid ""
1563 "Within a user namespace, these capabilities allow a process to bypass the "
1564 "rules if the process has the relevant capability over the file, meaning that:"
1565 msgstr ""
1566 "داخل مساحة مستخدم، تسمح هذه القدرات لعملية بتجاوز القواعد إذا كانت العملية "
1567 "تمتلك القدرة ذات الصلة على الملف، مما يعني أن:"
1568
1569 #. type: Plain text
1570 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1571 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1572 msgid ""
1573 "the process has the relevant effective capability in its user namespace; and"
1574 msgstr "تمتلك العملية القدرة الفعالة ذات الصلة في مساحة المستخدم الخاصة بها؛ و"
1575
1576 #. type: Plain text
1577 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1578 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1579 msgid ""
1580 "the file's user ID and group ID both have valid mappings in the user "
1581 "namespace."
1582 msgstr ""
1583 "كل من معرف المستخدم ومعرف المجموعة للملف لهما رسوم صالحة في مساحة المستخدم."
1584
1585 #
1586 #. #-#-#-#-# archlinux: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1587 #. These are the checks performed by the kernel function
1588 #. inode_owner_or_capable(). There is one exception to the exception:
1589 #. overriding the directory sticky permission bit requires that
1590 #. the file has a valid mapping for both its UID and GID.
1591 #. ============================================================
1592 #. type: Plain text
1593 #. #-#-#-#-# debian-trixie: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1594 #. These are the checks performed by the kernel function
1595 #. inode_owner_or_capable(). There is one exception to the exception:
1596 #. overriding the directory sticky permission bit requires that
1597 #. the file has a valid mapping for both its UID and GID.
1598 #. ============================================================
1599 #. type: Plain text
1600 #. #-#-#-#-# debian-unstable: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1601 #. These are the checks performed by the kernel function
1602 #. inode_owner_or_capable(). There is one exception to the exception:
1603 #. overriding the directory sticky permission bit requires that
1604 #. the file has a valid mapping for both its UID and GID.
1605 #. ============================================================
1606 #. type: Plain text
1607 #. #-#-#-#-# fedora-44: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1608 #. These are the checks performed by the kernel function
1609 #. inode_owner_or_capable(). There is one exception to the exception:
1610 #. overriding the directory sticky permission bit requires that
1611 #. the file has a valid mapping for both its UID and GID.
1612 #. ============================================================
1613 #. type: Plain text
1614 #. #-#-#-#-# fedora-rawhide: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1615 #. These are the checks performed by the kernel function
1616 #. inode_owner_or_capable(). There is one exception to the exception:
1617 #. overriding the directory sticky permission bit requires that
1618 #. the file has a valid mapping for both its UID and GID.
1619 #. ============================================================
1620 #. type: Plain text
1621 #. #-#-#-#-# mageia-cauldron: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1622 #. These are the checks performed by the kernel function
1623 #. inode_owner_or_capable(). There is one exception to the exception:
1624 #. overriding the directory sticky permission bit requires that
1625 #. the file has a valid mapping for both its UID and GID.
1626 #. ============================================================
1627 #. type: Plain text
1628 #. #-#-#-#-# opensuse-leap-16-1: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1629 #. These are the checks performed by the kernel function
1630 #. inode_owner_or_capable(). There is one exception to the exception:
1631 #. overriding the directory sticky permission bit requires that
1632 #. the file has a valid mapping for both its UID and GID.
1633 #. ============================================================
1634 #. type: Plain text
1635 #. #-#-#-#-# opensuse-tumbleweed: user_namespaces.7.pot (PACKAGE VERSION) #-#-#-#-#
1636 #. These are the checks performed by the kernel function
1637 #. inode_owner_or_capable(). There is one exception to the exception:
1638 #. overriding the directory sticky permission bit requires that
1639 #. the file has a valid mapping for both its UID and GID.
1640 #. ============================================================
1641 #. type: Plain text
1642 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1643 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1644 msgid ""
1645 "The B<CAP_FOWNER> capability is treated somewhat exceptionally: it allows a "
1646 "process to bypass the corresponding rules so long as at least the file's "
1647 "user ID has a mapping in the user namespace (i.e., the file's group ID does "
1648 "not need to have a valid mapping)."
1649 msgstr ""
1650 "تُعامل القدرة B<CAP_FOWNER> بشكل استثنائي إلى حد ما: فهي تسمح لعملية بتجاوز "
1651 "القواعد المقابلة طالما أن معرف مستخدم الملف على الأقل له رسم في مساحة "
1652 "المستخدم (أي، لا يحتاج معرف مجموعة الملف إلى رسم صالح)."
1653
1654 #. type: SS
1655 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1656 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1657 #, no-wrap
1658 msgid "Set-user-ID and set-group-ID programs"
1659 msgstr "برامج set-user-ID و set-group-ID"
1660
1661 #
1662 #. ============================================================
1663 #. type: Plain text
1664 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1665 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1666 msgid ""
1667 "When a process inside a user namespace executes a set-user-ID (set-group-ID) "
1668 "program, the process's effective user (group) ID inside the namespace is "
1669 "changed to whatever value is mapped for the user (group) ID of the file. "
1670 "However, if either the user I<or> the group ID of the file has no mapping "
1671 "inside the namespace, the set-user-ID (set-group-ID) bit is silently "
1672 "ignored: the new program is executed, but the process's effective user "
1673 "(group) ID is left unchanged. (This mirrors the semantics of executing a "
1674 "set-user-ID or set-group-ID program that resides on a filesystem that was "
1675 "mounted with the B<MS_NOSUID> flag, as described in B<mount>(2).)"
1676 msgstr ""
1677 "عندما تنفذ عملية داخل مساحة مستخدم برنامج set-user-ID (set-group-ID)، يُغيَّر "
1678 "معرف المستخدم (المجموعة) الفعال للعملية داخل المساحة إلى أي قيمة مُرسَمة"
1679 " لمعرف "
1680 "المستخدم (المجموعة) للملف. ومع ذلك، إذا كان إما معرف المستخدم I<أو> معرف "
1681 "المجموعة للملف ليس له رسم داخل المساحة، يُتجاهل بت set-user-ID (set-group-ID) "
1682 "بصمت: يُنفَّذ البرنامج الجديد، لكن يبقى معرف المستخدم (المجموعة) الفعال"
1683 " للعملية "
1684 "دون تغيير. (يعكس هذا دلالات تنفيذ برنامج set-user-ID أو set-group-ID الموجود "
1685 "على نظام ملفات تم وصله مع علامة B<MS_NOSUID>، كما هو موصوف في B<mount>(2).)"
1686
1687 #. type: SS
1688 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1689 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1690 #, no-wrap
1691 msgid "Miscellaneous"
1692 msgstr "متفرقات"
1693
1694 #. type: Plain text
1695 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1696 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1697 msgid ""
1698 "When a process's user and group IDs are passed over a UNIX domain socket to "
1699 "a process in a different user namespace (see the description of "
1700 "B<SCM_CREDENTIALS> in B<unix>(7)), they are translated into the "
1701 "corresponding values as per the receiving process's user and group ID "
1702 "mappings."
1703 msgstr ""
1704 "عندما تُمرَّر معرفات المستخدم والمجموعة لعملية عبر مقبس نطاق UNIX إلى عملية"
1705 " في "
1706 "مساحة مستخدم مختلفة (انظر وصف B<SCM_CREDENTIALS> في B<unix>(7))، تُترجَم إلى "
1707 "القيم المقابلة وفقًا لرسوم معرفات المستخدم والمجموعة للعملية المُستقبِلة."
1708
1709 #. type: SH
1710 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1711 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1712 #, no-wrap
1713 msgid "STANDARDS"
1714 msgstr "المعايير"
1715
1716 #. type: Plain text
1717 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1718 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1719 msgid "Linux."
1720 msgstr "لينكس."
1721
1722 #. type: SH
1723 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1724 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1725 #, no-wrap
1726 msgid "NOTES"
1727 msgstr "ملاحظات"
1728
1729 #
1730 #. ============================================================
1731 #. type: Plain text
1732 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1733 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1734 msgid ""
1735 "Over the years, there have been a lot of features that have been added to "
1736 "the Linux kernel that have been made available only to privileged users "
1737 "because of their potential to confuse set-user-ID-root applications. In "
1738 "general, it becomes safe to allow the root user in a user namespace to use "
1739 "those features because it is impossible, while in a user namespace, to gain "
1740 "more privilege than the root user of a user namespace has."
1741 msgstr ""
1742 "على مر السنين، أُضيفت العديد من الميزات إلى نواة Linux والتي أصبحت متاحة فقط "
1743 "للمستخدمين المُمتازين بسبب قدرتها على إرباك تطبيقات set-user-ID-root. بشكل "
1744 "عام، يصبح من الآمن السماح للمستخدم الجذر في مساحة مستخدم باستخدام تلك "
1745 "الميزات لأنه من المستحيل، أثناء وجودك في مساحة مستخدم، الحصول على امتياز "
1746 "أكثر مما يمتلكه المستخدم الجذر لمساحة المستخدم."
1747
1748 #. type: SS
1749 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1750 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1751 #, no-wrap
1752 msgid "Global root"
1753 msgstr "الجذر العام"
1754
1755 #
1756 #. ============================================================
1757 #. type: Plain text
1758 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1759 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1760 msgid ""
1761 "The term \"global root\" is sometimes used as a shorthand for user ID 0 in "
1762 "the initial user namespace."
1763 msgstr ""
1764 "يُستخدم المصطلح \"جذر عام\" أحيانًا كاختصار لمعرف المستخدم 0 في مساحة"
1765 " المستخدم "
1766 "الأولية."
1767
1768 #. type: SS
1769 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1770 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1771 #, no-wrap
1772 msgid "Availability"
1773 msgstr "التوفر"
1774
1775 #. type: Plain text
1776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1778 msgid ""
1779 "Use of user namespaces requires a kernel that is configured with the "
1780 "B<CONFIG_USER_NS> option. User namespaces require support in a range of "
1781 "subsystems across the kernel. When an unsupported subsystem is configured "
1782 "into the kernel, it is not possible to configure user namespaces support."
1783 msgstr ""
1784 "يتطلب استخدام مساحات المستخدم نواة مُهيأة بخيار B<CONFIG_USER_NS>. تتطلب "
1785 "مساحات المستخدم دعمًا في مجموعة من الأنظمة الفرعية عبر النواة. عندما يُهيأ "
1786 "نظام فرعي غير مدعوم في النواة، لا يمكن تهيئة دعم مساحات المستخدم."
1787
1788 #. commit d6970d4b726cea6d7a9bc4120814f95c09571fc3
1789 #. type: Plain text
1790 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1791 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1792 msgid ""
1793 "As at Linux 3.8, most relevant subsystems supported user namespaces, but a "
1794 "number of filesystems did not have the infrastructure needed to map user and "
1795 "group IDs between user namespaces. Linux 3.9 added the required "
1796 "infrastructure support for many of the remaining unsupported filesystems "
1797 "(Plan 9 (9P), Andrew File System (AFS), Ceph, CIFS, CODA, NFS, and OCFS2). "
1798 "Linux 3.12 added support for the last of the unsupported major filesystems, "
1799 "XFS."
1800 msgstr ""
1801 "اعتبارًا من Linux 3.8، دعمت معظم الأنظمة الفرعية ذات الصلة مساحات المستخدم، "
1802 "لكن عددًا من أنظمة الملفات لم تمتلك البنية التحتية اللازمة لرسم معرفات "
1803 "المستخدم والمجموعة بين مساحات المستخدم. أضاف Linux 3.9 دعم البنية التحتية "
1804 "المطلوبة للعديد من أنظمة الملفات غير المدعومة المتبقية (Plan 9 (9P)، Andrew "
1805 "File System (AFS)، Ceph، CIFS، CODA، NFS، و OCFS2). أضاف Linux 3.12 دعمًا "
1806 "لآخر أنظمة الملفات الرئيسية غير المدعومة، XFS."
1807
1808 #. type: SH
1809 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1810 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1811 #, no-wrap
1812 msgid "EXAMPLES"
1813 msgstr "أمثلة"
1814
1815 #. type: Plain text
1816 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1817 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1818 msgid ""
1819 "The program below is designed to allow experimenting with user namespaces, "
1820 "as well as other types of namespaces. It creates namespaces as specified by "
1821 "command-line options and then executes a command inside those namespaces. "
1822 "The comments and I<usage>() function inside the program provide a full "
1823 "explanation of the program. The following shell session demonstrates its "
1824 "use."
1825 msgstr ""
1826 "البرنامج أدناه مصمم للسماح بالتجربة مع مساحات المستخدم، بالإضافة إلى أنواع "
1827 "أخرى من المساحات. ينشئ مساحات كما هو محدد بواسطة خيارات سطر الأوامر ثم ينفذ "
1828 "أمرًا داخل تلك المساحات. توفر التعليقات ودالة I<usage>() داخل البرنامج شرحًا "
1829 "كاملاً للبرنامج. توضح جلسة الصدفة التالية استخدامه."
1830
1831 #. type: Plain text
1832 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1833 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1834 msgid "First, we look at the run-time environment:"
1835 msgstr "أولاً، ننظر إلى بيئة وقت التشغيل:"
1836
1837 #. type: Plain text
1838 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1839 #: opensuse-tumbleweed
1840 #, no-wrap
1841 msgid ""
1842 "$B< uname -rs>; # Need Linux 3.8 or later\n"
1843 "Linux 3.8.0\n"
1844 "$B< id -u>; # Running as unprivileged user\n"
1845 "1000\n"
1846 "$B< id -g>;\n"
1847 "1000\n"
1848 msgstr ""
1849 "$B< uname -rs>; # Need Linux 3.8 or later\n"
1850 "Linux 3.8.0\n"
1851 "$B< id -u>; # Running as unprivileged user\n"
1852 "1000\n"
1853 "$B< id -g>;\n"
1854 "1000\n"
1855
1856 #. type: Plain text
1857 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1858 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1859 msgid ""
1860 "Now start a new shell in new user (I<-U>), mount (I<-m>), and PID (I<-p>) "
1861 "namespaces, with user ID (I<-M>) and group ID (I<-G>) 1000 mapped to 0 "
1862 "inside the user namespace:"
1863 msgstr ""
1864 "الآن ابدأ صدفة جديدة في مساحات مستخدم جديدة (I<-U>)، وصل (I<-m>)، و PID (I<-"
1865 "p>)، مع معرف مستخدم (I<-M>) ومعرف مجموعة (I<-G>) 1000 مرسوم إلى 0 داخل مساحة "
1866 "المستخدم:"
1867
1868 #. type: Plain text
1869 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1870 #: opensuse-tumbleweed
1871 #, no-wrap
1872 msgid ""
1873 "$B< ./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000"
1874 " 1\\[aq] bash>;\n"
1875 msgstr ""
1876 "$B< ./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000"
1877 " 1\\[aq] bash>;\n"
1878
1879 #. type: Plain text
1880 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1881 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1882 msgid ""
1883 "The shell has PID 1, because it is the first process in the new PID "
1884 "namespace:"
1885 msgstr "تمتلك الصدفة PID 1، لأنها أول عملية في مساحة PID الجديدة:"
1886
1887 #. type: Plain text
1888 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1889 #: opensuse-tumbleweed
1890 #, no-wrap
1891 msgid ""
1892 "bash$B< echo $$>;\n"
1893 "1\n"
1894 msgstr ""
1895 "bash$B< echo $$>;\n"
1896 "1\n"
1897
1898 #. type: Plain text
1899 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1900 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1901 msgid ""
1902 "Mounting a new I</proc> filesystem and listing all of the processes visible "
1903 "in the new PID namespace shows that the shell can't see any processes "
1904 "outside the PID namespace:"
1905 msgstr ""
1906 "وصل نظام ملفات I</proc> جديد وسرد جميع العمليات المرئية في فضاء PID الجديد "
1907 "يُظهر أن الصدفة لا تستطيع رؤية أي عمليات خارج فضاء PID:"
1908
1909 #. type: Plain text
1910 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1911 #: opensuse-tumbleweed
1912 #, no-wrap
1913 msgid ""
1914 "bash$B< mount -t proc proc /proc>;\n"
1915 "bash$B< ps ax>;\n"
1916 " PID TTY STAT TIME COMMAND\n"
1917 " 1 pts/3 S 0:00 bash\n"
1918 " 22 pts/3 R+ 0:00 ps ax\n"
1919 msgstr ""
1920 "bash$B< mount -t proc proc /proc>;\n"
1921 "bash$B< ps ax>;\n"
1922 " PID TTY STAT TIME COMMAND\n"
1923 " 1 pts/3 S 0:00 bash\n"
1924 " 22 pts/3 R+ 0:00 ps ax\n"
1925
1926 #. type: Plain text
1927 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1928 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1929 msgid ""
1930 "Inside the user namespace, the shell has user and group ID 0, and a full set "
1931 "of permitted and effective capabilities:"
1932 msgstr ""
1933 "داخل فضاء المستخدم، تمتلك الصدفة معرف المستخدم والمجموعة 0، ومجموعة كاملة من "
1934 "القدرات المسموح بها والفعالة:"
1935
1936 #. type: Plain text
1937 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1938 #: opensuse-tumbleweed
1939 #, no-wrap
1940 msgid ""
1941 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>;\n"
1942 "Uid:\t0\t0\t0\t0\n"
1943 "Gid:\t0\t0\t0\t0\n"
1944 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>;\n"
1945 "CapInh:\t0000000000000000\n"
1946 "CapPrm:\t0000001fffffffff\n"
1947 "CapEff:\t0000001fffffffff\n"
1948 msgstr ""
1949 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>;\n"
1950 "Uid:\t0\t0\t0\t0\n"
1951 "Gid:\t0\t0\t0\t0\n"
1952 "bash$B< cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>;\n"
1953 "CapInh:\t0000000000000000\n"
1954 "CapPrm:\t0000001fffffffff\n"
1955 "CapEff:\t0000001fffffffff\n"
1956
1957 #. type: SS
1958 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1959 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1960 #, no-wrap
1961 msgid "Program source"
1962 msgstr "مصدر البرنامج"
1963
1964 #. type: Plain text
1965 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1966 #: opensuse-tumbleweed
1967 #, no-wrap
1968 msgid ""
1969 "/* userns_child_exec.c\n"
1970 "\\&\n"
1971 " Licensed under GNU General Public License v2 or later\n"
1972 "\\&\n"
1973 " Create a child process that executes a shell command in new\n"
1974 " namespace(s); allow UID and GID mappings to be specified when\n"
1975 " creating a user namespace.\n"
1976 "*/\n"
1977 "#define _GNU_SOURCE\n"
1978 "#include E<lt>err.hE<gt>\n"
1979 "#include E<lt>sched.hE<gt>\n"
1980 "#include E<lt>unistd.hE<gt>\n"
1981 "#include E<lt>stdint.hE<gt>\n"
1982 "#include E<lt>stdlib.hE<gt>\n"
1983 "#include E<lt>sys/wait.hE<gt>\n"
1984 "#include E<lt>signal.hE<gt>\n"
1985 "#include E<lt>fcntl.hE<gt>\n"
1986 "#include E<lt>stdio.hE<gt>\n"
1987 "#include E<lt>string.hE<gt>\n"
1988 "#include E<lt>limits.hE<gt>\n"
1989 "#include E<lt>errno.hE<gt>\n"
1990 "\\&\n"
1991 "struct child_args {\n"
1992 " char **argv; /* Command to be executed by child, with args */\n"
1993 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
1994 "};\n"
1995 "\\&\n"
1996 "static int verbose;\n"
1997 "\\&\n"
1998 "static void\n"
1999 "usage(char *pname)\n"
2000 "{\n"
2001 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
2002 " pname);\n"
2003 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
2004 " \"command in a new user namespace,\\[rs]n\"\n"
2005 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
2006 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
2007 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
2008 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
2009 " fpe(\"-m New mount namespace\\[rs]n\");\n"
2010 " fpe(\"-n New network namespace\\[rs]n\");\n"
2011 " fpe(\"-p New PID namespace\\[rs]n\");\n"
2012 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
2013 " fpe(\"-U New user namespace\\[rs]n\");\n"
2014 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
2015 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
2016 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
2017 " namespace\\[rs]n\");\n"
2018 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
2019 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
2020 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
2021 " fpe(\"\\[rs]n\");\n"
2022 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
2023 " fpe(\"It is not permitted to specify both -z and either -M or"
2024 " -G.\\[rs]n\");\n"
2025 " fpe(\"\\[rs]n\");\n"
2026 " fpe(\"Map strings for -M and -G consist of records of the"
2027 " form:\\[rs]n\");\n"
2028 " fpe(\"\\[rs]n\");\n"
2029 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
2030 " fpe(\"\\[rs]n\");\n"
2031 " fpe(\"A map string can contain multiple records, separated\"\n"
2032 " \" by commas;\\[rs]n\");\n"
2033 " fpe(\"the commas are replaced by newlines before writing\"\n"
2034 " \" to map files.\\[rs]n\");\n"
2035 "\\&\n"
2036 " exit(EXIT_FAILURE);\n"
2037 "}\n"
2038 "\\&\n"
2039 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
2040 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID"
2041 " or\n"
2042 " GID mapping consists of one or more newline-delimited records\n"
2043 " of the form:\n"
2044 "\\&\n"
2045 " ID_inside-ns ID-outside-ns size\n"
2046 "\\&\n"
2047 " Requiring the user to supply a string that contains newlines is\n"
2048 " of course inconvenient for command-line use. Thus, we permit the\n"
2049 " use of commas to delimit records in this string, and replace them\n"
2050 " with newlines before writing the string to the file. */\n"
2051 "\\&\n"
2052 "static void\n"
2053 "update_map(char *mapping, char *map_file)\n"
2054 "{\n"
2055 " int fd;\n"
2056 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
2057 "\\&\n"
2058 " /* Replace commas in mapping string with newlines. */\n"
2059 "\\&\n"
2060 " map_len = strlen(mapping);\n"
2061 " for (size_t j = 0; j E<lt> map_len; j++)\n"
2062 " if (mapping[j] == \\[aq],\\[aq])\n"
2063 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
2064 "\\&\n"
2065 " fd = open(map_file, O_RDWR);\n"
2066 " if (fd == -1) {\n"
2067 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
2068 " strerror(errno));\n"
2069 " exit(EXIT_FAILURE);\n"
2070 " }\n"
2071 "\\&\n"
2072 " if (write(fd, mapping, map_len) != map_len) {\n"
2073 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
2074 " strerror(errno));\n"
2075 " exit(EXIT_FAILURE);\n"
2076 " }\n"
2077 "\\&\n"
2078 " close(fd);\n"
2079 "}\n"
2080 "\\&\n"
2081 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
2082 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
2083 " allowed *unprivileged* users to employ user namespaces in\n"
2084 " order to drop groups. The upshot of the 3.19 changes is that\n"
2085 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
2086 " system call in this user namespace must first be disabled by\n"
2087 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
2088 " this namespace. That is the purpose of the following function. */\n"
2089 "\\&\n"
2090 "static void\n"
2091 "proc_setgroups_write(pid_t child_pid, char *str)\n"
2092 "{\n"
2093 " char setgroups_path[PATH_MAX];\n"
2094 " int fd;\n"
2095 "\\&\n"
2096 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
2097 " (intmax_t) child_pid);\n"
2098 "\\&\n"
2099 " fd = open(setgroups_path, O_RDWR);\n"
2100 " if (fd == -1) {\n"
2101 "\\&\n"
2102 " /* We may be on a system that doesn\\[aq]t support\n"
2103 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
2104 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
2105 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
2106 " order\n"
2107 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
2108 "\\&\n"
2109 " However, if the error from open() was something other than\n"
2110 " the ENOENT error that is expected for that case, let the\n"
2111 " user know. */\n"
2112 "\\&\n"
2113 " if (errno != ENOENT)\n"
2114 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
2115 " strerror(errno));\n"
2116 " return;\n"
2117 " }\n"
2118 "\\&\n"
2119 " if (write(fd, str, strlen(str)) == -1)\n"
2120 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
2121 " strerror(errno));\n"
2122 "\\&\n"
2123 " close(fd);\n"
2124 "}\n"
2125 "\\&\n"
2126 "static int /* Start function for cloned child */\n"
2127 "childFunc(void *arg)\n"
2128 "{\n"
2129 " struct child_args *args = arg;\n"
2130 " char ch;\n"
2131 "\\&\n"
2132 " /* Wait until the parent has updated the UID and GID mappings.\n"
2133 " See the comment in main(). We wait for end of file on a\n"
2134 " pipe that will be closed by the parent process once it has\n"
2135 " updated the mappings. */\n"
2136 "\\&\n"
2137 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
2138 " end of the pipe so that we see EOF\n"
2139 " when parent closes its descriptor. */\n"
2140 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
2141 " fprintf(stderr,\n"
2142 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
2143 " exit(EXIT_FAILURE);\n"
2144 " }\n"
2145 "\\&\n"
2146 " close(args-E<gt>pipe_fd[0]);\n"
2147 "\\&\n"
2148 " /* Execute a shell command. */\n"
2149 "\\&\n"
2150 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
2151 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
2152 " err(EXIT_FAILURE, \"execvp\");\n"
2153 "}\n"
2154 "\\&\n"
2155 "#define STACK_SIZE (1024 * 1024)\n"
2156 "\\&\n"
2157 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
2158 "\\&\n"
2159 "int\n"
2160 "main(int argc, char *argv[])\n"
2161 "{\n"
2162 " int flags, opt, map_zero;\n"
2163 " pid_t child_pid;\n"
2164 " struct child_args args;\n"
2165 " char *uid_map, *gid_map;\n"
2166 " const int MAP_BUF_SIZE = 100;\n"
2167 " char map_buf[MAP_BUF_SIZE];\n"
2168 " char map_path[PATH_MAX];\n"
2169 "\\&\n"
2170 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
2171 " the final getopt() argument prevents GNU-style permutation\n"
2172 " of command-line options. That\\[aq]s useful, since sometimes\n"
2173 " the \\[aq]command\\[aq] to be executed by this program itself\n"
2174 " has command-line options. We don\\[aq]t want getopt() to treat\n"
2175 " those as options to this program. */\n"
2176 "\\&\n"
2177 " flags = 0;\n"
2178 " verbose = 0;\n"
2179 " gid_map = NULL;\n"
2180 " uid_map = NULL;\n"
2181 " map_zero = 0;\n"
2182 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
2183 " switch (opt) {\n"
2184 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
2185 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
2186 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
2187 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
2188 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
2189 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
2190 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
2191 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
2192 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
2193 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
2194 " default: usage(argv[0]);\n"
2195 " }\n"
2196 " }\n"
2197 "\\&\n"
2198 " /* -M or -G without -U is nonsensical */\n"
2199 "\\&\n"
2200 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
2201 " !(flags & CLONE_NEWUSER)) ||\n"
2202 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
2203 " usage(argv[0]);\n"
2204 "\\&\n"
2205 " args.argv = &argv[optind];\n"
2206 "\\&\n"
2207 " /* We use a pipe to synchronize the parent and child, in order to\n"
2208 " ensure that the parent sets the UID and GID maps before the child\n"
2209 " calls execve(). This ensures that the child maintains its\n"
2210 " capabilities during the execve() in the common case where we\n"
2211 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
2212 " namespace. Without this synchronization, the child would lose\n"
2213 " its capabilities if it performed an execve() with nonzero\n"
2214 " user IDs (see the capabilities(7) man page for details of the\n"
2215 " transformation of a process\\[aq]s capabilities during execve()). */\n"
2216 "\\&\n"
2217 " if (pipe(args.pipe_fd) == -1)\n"
2218 " err(EXIT_FAILURE, \"pipe\");\n"
2219 "\\&\n"
2220 " /* Create the child in new namespace(s). */\n"
2221 "\\&\n"
2222 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
2223 " flags | SIGCHLD, &args);\n"
2224 " if (child_pid == -1)\n"
2225 " err(EXIT_FAILURE, \"clone\");\n"
2226 "\\&\n"
2227 " /* Parent falls through to here. */\n"
2228 "\\&\n"
2229 " if (verbose)\n"
2230 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
2231 " argv[0], (intmax_t) child_pid);\n"
2232 "\\&\n"
2233 " /* Update the UID and GID maps in the child. */\n"
2234 "\\&\n"
2235 " if (uid_map != NULL || map_zero) {\n"
2236 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
2237 " (intmax_t) child_pid);\n"
2238 " if (map_zero) {\n"
2239 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
2240 " (intmax_t) getuid());\n"
2241 " uid_map = map_buf;\n"
2242 " }\n"
2243 " update_map(uid_map, map_path);\n"
2244 " }\n"
2245 "\\&\n"
2246 " if (gid_map != NULL || map_zero) {\n"
2247 " proc_setgroups_write(child_pid, \"deny\");\n"
2248 "\\&\n"
2249 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
2250 " (intmax_t) child_pid);\n"
2251 " if (map_zero) {\n"
2252 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
2253 " (intmax_t) getgid());\n"
2254 " gid_map = map_buf;\n"
2255 " }\n"
2256 " update_map(gid_map, map_path);\n"
2257 " }\n"
2258 "\\&\n"
2259 " /* Close the write end of the pipe, to signal to the child that we\n"
2260 " have updated the UID and GID maps. */\n"
2261 "\\&\n"
2262 " close(args.pipe_fd[1]);\n"
2263 "\\&\n"
2264 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
2265 " err(EXIT_FAILURE, \"waitpid\");\n"
2266 "\\&\n"
2267 " if (verbose)\n"
2268 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
2269 "\\&\n"
2270 " exit(EXIT_SUCCESS);\n"
2271 "}\n"
2272 msgstr ""
2273 "/* userns_child_exec.c\n"
2274 "\\&\n"
2275 " Licensed under GNU General Public License v2 or later\n"
2276 "\\&\n"
2277 " Create a child process that executes a shell command in new\n"
2278 " namespace(s); allow UID and GID mappings to be specified when\n"
2279 " creating a user namespace.\n"
2280 "*/\n"
2281 "#define _GNU_SOURCE\n"
2282 "#include E<lt>err.hE<gt>\n"
2283 "#include E<lt>sched.hE<gt>\n"
2284 "#include E<lt>unistd.hE<gt>\n"
2285 "#include E<lt>stdint.hE<gt>\n"
2286 "#include E<lt>stdlib.hE<gt>\n"
2287 "#include E<lt>sys/wait.hE<gt>\n"
2288 "#include E<lt>signal.hE<gt>\n"
2289 "#include E<lt>fcntl.hE<gt>\n"
2290 "#include E<lt>stdio.hE<gt>\n"
2291 "#include E<lt>string.hE<gt>\n"
2292 "#include E<lt>limits.hE<gt>\n"
2293 "#include E<lt>errno.hE<gt>\n"
2294 "\\&\n"
2295 "struct child_args {\n"
2296 " char **argv; /* Command to be executed by child, with args */\n"
2297 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
2298 "};\n"
2299 "\\&\n"
2300 "static int verbose;\n"
2301 "\\&\n"
2302 "static void\n"
2303 "usage(char *pname)\n"
2304 "{\n"
2305 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
2306 " pname);\n"
2307 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
2308 " \"command in a new user namespace,\\[rs]n\"\n"
2309 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
2310 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
2311 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
2312 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
2313 " fpe(\"-m New mount namespace\\[rs]n\");\n"
2314 " fpe(\"-n New network namespace\\[rs]n\");\n"
2315 " fpe(\"-p New PID namespace\\[rs]n\");\n"
2316 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
2317 " fpe(\"-U New user namespace\\[rs]n\");\n"
2318 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
2319 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
2320 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
2321 " namespace\\[rs]n\");\n"
2322 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
2323 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
2324 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
2325 " fpe(\"\\[rs]n\");\n"
2326 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
2327 " fpe(\"It is not permitted to specify both -z and either -M or"
2328 " -G.\\[rs]n\");\n"
2329 " fpe(\"\\[rs]n\");\n"
2330 " fpe(\"Map strings for -M and -G consist of records of the"
2331 " form:\\[rs]n\");\n"
2332 " fpe(\"\\[rs]n\");\n"
2333 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
2334 " fpe(\"\\[rs]n\");\n"
2335 " fpe(\"A map string can contain multiple records, separated\"\n"
2336 " \" by commas;\\[rs]n\");\n"
2337 " fpe(\"the commas are replaced by newlines before writing\"\n"
2338 " \" to map files.\\[rs]n\");\n"
2339 "\\&\n"
2340 " exit(EXIT_FAILURE);\n"
2341 "}\n"
2342 "\\&\n"
2343 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
2344 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID"
2345 " or\n"
2346 " GID mapping consists of one or more newline-delimited records\n"
2347 " of the form:\n"
2348 "\\&\n"
2349 " ID_inside-ns ID-outside-ns size\n"
2350 "\\&\n"
2351 " Requiring the user to supply a string that contains newlines is\n"
2352 " of course inconvenient for command-line use. Thus, we permit the\n"
2353 " use of commas to delimit records in this string, and replace them\n"
2354 " with newlines before writing the string to the file. */\n"
2355 "\\&\n"
2356 "static void\n"
2357 "update_map(char *mapping, char *map_file)\n"
2358 "{\n"
2359 " int fd;\n"
2360 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
2361 "\\&\n"
2362 " /* Replace commas in mapping string with newlines. */\n"
2363 "\\&\n"
2364 " map_len = strlen(mapping);\n"
2365 " for (size_t j = 0; j E<lt> map_len; j++)\n"
2366 " if (mapping[j] == \\[aq],\\[aq])\n"
2367 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
2368 "\\&\n"
2369 " fd = open(map_file, O_RDWR);\n"
2370 " if (fd == -1) {\n"
2371 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
2372 " strerror(errno));\n"
2373 " exit(EXIT_FAILURE);\n"
2374 " }\n"
2375 "\\&\n"
2376 " if (write(fd, mapping, map_len) != map_len) {\n"
2377 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
2378 " strerror(errno));\n"
2379 " exit(EXIT_FAILURE);\n"
2380 " }\n"
2381 "\\&\n"
2382 " close(fd);\n"
2383 "}\n"
2384 "\\&\n"
2385 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
2386 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
2387 " allowed *unprivileged* users to employ user namespaces in\n"
2388 " order to drop groups. The upshot of the 3.19 changes is that\n"
2389 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
2390 " system call in this user namespace must first be disabled by\n"
2391 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
2392 " this namespace. That is the purpose of the following function. */\n"
2393 "\\&\n"
2394 "static void\n"
2395 "proc_setgroups_write(pid_t child_pid, char *str)\n"
2396 "{\n"
2397 " char setgroups_path[PATH_MAX];\n"
2398 " int fd;\n"
2399 "\\&\n"
2400 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
2401 " (intmax_t) child_pid);\n"
2402 "\\&\n"
2403 " fd = open(setgroups_path, O_RDWR);\n"
2404 " if (fd == -1) {\n"
2405 "\\&\n"
2406 " /* We may be on a system that doesn\\[aq]t support\n"
2407 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
2408 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
2409 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
2410 " order\n"
2411 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
2412 "\\&\n"
2413 " However, if the error from open() was something other than\n"
2414 " the ENOENT error that is expected for that case, let the\n"
2415 " user know. */\n"
2416 "\\&\n"
2417 " if (errno != ENOENT)\n"
2418 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
2419 " strerror(errno));\n"
2420 " return;\n"
2421 " }\n"
2422 "\\&\n"
2423 " if (write(fd, str, strlen(str)) == -1)\n"
2424 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
2425 " strerror(errno));\n"
2426 "\\&\n"
2427 " close(fd);\n"
2428 "}\n"
2429 "\\&\n"
2430 "static int /* Start function for cloned child */\n"
2431 "childFunc(void *arg)\n"
2432 "{\n"
2433 " struct child_args *args = arg;\n"
2434 " char ch;\n"
2435 "\\&\n"
2436 " /* Wait until the parent has updated the UID and GID mappings.\n"
2437 " See the comment in main(). We wait for end of file on a\n"
2438 " pipe that will be closed by the parent process once it has\n"
2439 " updated the mappings. */\n"
2440 "\\&\n"
2441 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
2442 " end of the pipe so that we see EOF\n"
2443 " when parent closes its descriptor. */\n"
2444 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
2445 " fprintf(stderr,\n"
2446 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
2447 " exit(EXIT_FAILURE);\n"
2448 " }\n"
2449 "\\&\n"
2450 " close(args-E<gt>pipe_fd[0]);\n"
2451 "\\&\n"
2452 " /* Execute a shell command. */\n"
2453 "\\&\n"
2454 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
2455 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
2456 " err(EXIT_FAILURE, \"execvp\");\n"
2457 "}\n"
2458 "\\&\n"
2459 "#define STACK_SIZE (1024 * 1024)\n"
2460 "\\&\n"
2461 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
2462 "\\&\n"
2463 "int\n"
2464 "main(int argc, char *argv[])\n"
2465 "{\n"
2466 " int flags, opt, map_zero;\n"
2467 " pid_t child_pid;\n"
2468 " struct child_args args;\n"
2469 " char *uid_map, *gid_map;\n"
2470 " const int MAP_BUF_SIZE = 100;\n"
2471 " char map_buf[MAP_BUF_SIZE];\n"
2472 " char map_path[PATH_MAX];\n"
2473 "\\&\n"
2474 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
2475 " the final getopt() argument prevents GNU-style permutation\n"
2476 " of command-line options. That\\[aq]s useful, since sometimes\n"
2477 " the \\[aq]command\\[aq] to be executed by this program itself\n"
2478 " has command-line options. We don\\[aq]t want getopt() to treat\n"
2479 " those as options to this program. */\n"
2480 "\\&\n"
2481 " flags = 0;\n"
2482 " verbose = 0;\n"
2483 " gid_map = NULL;\n"
2484 " uid_map = NULL;\n"
2485 " map_zero = 0;\n"
2486 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
2487 " switch (opt) {\n"
2488 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
2489 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
2490 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
2491 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
2492 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
2493 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
2494 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
2495 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
2496 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
2497 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
2498 " default: usage(argv[0]);\n"
2499 " }\n"
2500 " }\n"
2501 "\\&\n"
2502 " /* -M or -G without -U is nonsensical */\n"
2503 "\\&\n"
2504 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
2505 " !(flags & CLONE_NEWUSER)) ||\n"
2506 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
2507 " usage(argv[0]);\n"
2508 "\\&\n"
2509 " args.argv = &argv[optind];\n"
2510 "\\&\n"
2511 " /* We use a pipe to synchronize the parent and child, in order to\n"
2512 " ensure that the parent sets the UID and GID maps before the child\n"
2513 " calls execve(). This ensures that the child maintains its\n"
2514 " capabilities during the execve() in the common case where we\n"
2515 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
2516 " namespace. Without this synchronization, the child would lose\n"
2517 " its capabilities if it performed an execve() with nonzero\n"
2518 " user IDs (see the capabilities(7) man page for details of the\n"
2519 " transformation of a process\\[aq]s capabilities during execve()). */\n"
2520 "\\&\n"
2521 " if (pipe(args.pipe_fd) == -1)\n"
2522 " err(EXIT_FAILURE, \"pipe\");\n"
2523 "\\&\n"
2524 " /* Create the child in new namespace(s). */\n"
2525 "\\&\n"
2526 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
2527 " flags | SIGCHLD, &args);\n"
2528 " if (child_pid == -1)\n"
2529 " err(EXIT_FAILURE, \"clone\");\n"
2530 "\\&\n"
2531 " /* Parent falls through to here. */\n"
2532 "\\&\n"
2533 " if (verbose)\n"
2534 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
2535 " argv[0], (intmax_t) child_pid);\n"
2536 "\\&\n"
2537 " /* Update the UID and GID maps in the child. */\n"
2538 "\\&\n"
2539 " if (uid_map != NULL || map_zero) {\n"
2540 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
2541 " (intmax_t) child_pid);\n"
2542 " if (map_zero) {\n"
2543 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
2544 " (intmax_t) getuid());\n"
2545 " uid_map = map_buf;\n"
2546 " }\n"
2547 " update_map(uid_map, map_path);\n"
2548 " }\n"
2549 "\\&\n"
2550 " if (gid_map != NULL || map_zero) {\n"
2551 " proc_setgroups_write(child_pid, \"deny\");\n"
2552 "\\&\n"
2553 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
2554 " (intmax_t) child_pid);\n"
2555 " if (map_zero) {\n"
2556 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
2557 " (intmax_t) getgid());\n"
2558 " gid_map = map_buf;\n"
2559 " }\n"
2560 " update_map(gid_map, map_path);\n"
2561 " }\n"
2562 "\\&\n"
2563 " /* Close the write end of the pipe, to signal to the child that we\n"
2564 " have updated the UID and GID maps. */\n"
2565 "\\&\n"
2566 " close(args.pipe_fd[1]);\n"
2567 "\\&\n"
2568 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
2569 " err(EXIT_FAILURE, \"waitpid\");\n"
2570 "\\&\n"
2571 " if (verbose)\n"
2572 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
2573 "\\&\n"
2574 " exit(EXIT_SUCCESS);\n"
2575 "}\n"
2576
2577 #. type: SH
2578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2580 #, no-wrap
2581 msgid "SEE ALSO"
2582 msgstr "انظر أيضًا"
2583
2584 #. From the shadow package
2585 #. From the shadow package
2586 #. From the shadow package
2587 #. From the shadow package
2588 #. type: Plain text
2589 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2590 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2591 msgid ""
2592 "B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<ptrace>(2), B<setns>(2), "
2593 "B<unshare>(2), B<proc>(5), B<subgid>(5), B<subuid>(5), B<capabilities>(7), "
2594 "B<cgroup_namespaces>(7), B<credentials>(7), B<namespaces>(7), "
2595 "B<pid_namespaces>(7)"
2596 msgstr ""
2597 "B<newgidmap>(1)، B<newuidmap>(1)، B<clone>(2)، B<ptrace>(2)، B<setns>(2)، "
2598 "B<unshare>(2)، B<proc>(5), B<subgid>(5)، B<subuid>(5)، B<capabilities>(7)، "
2599 "B<cgroup_namespaces>(7)، B<credentials>(7)، B<namespaces>(7)، "
2600 "B<pid_namespaces>(7)"
2601
2602 #. type: Plain text
2603 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
2604 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
2605 msgid ""
2606 "The kernel source file I<Documentation/admin-guide/namespaces/resource-"
2607 "control.rst>."
2608 msgstr ""
2609 "ملف مصدر النواة I<Documentation/admin-guide/namespaces/resource-control.rst>."
2610
2611 #. type: TH
2612 #: debian-trixie
2613 #, no-wrap
2614 msgid "2024-06-15"
2615 msgstr "15 يونيو 2024"
2616
2617 #. type: TH
2618 #: debian-trixie
2619 #, no-wrap
2620 msgid "Linux man-pages 6.9.1"
2621 msgstr "صفحات دليل لينكس 6.9.1"
2622
2623 #. type: Plain text
2624 #: debian-trixie fedora-44 fedora-rawhide
2625 msgid ""
2626 "User namespaces can be nested; that is, each user namespace\\[em]except the "
2627 "initial (\"root\") namespace\\[em]has a parent user namespace, and can have "
2628 "zero or more child user namespaces. The parent user namespace is the user "
2629 "namespace of the process that creates the user namespace via a call to "
2630 "B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
2631 msgstr ""
2632 "يمكن أن تكون مساحات أسماء المستخدمين متداخلة؛ أي أن كل مساحة اسم مستخدم "
2633 "\\[em]باستثناء المساحة الأولية (\"الجذر\")\\[em] لها مساحة اسم مستخدم أب، "
2634 "ويمكن أن تحتوي على صفر أو أكثر من مساحات أسماء المستخدمين الفرعية. مساحة "
2635 "اسم المستخدم الأب هي مساحة اسم المستخدم للعملية التي تنشئ مساحة اسم المستخدم "
2636 "عبر استدعاء B<unshare>(2) أو B<clone>(2) مع العلم B<CLONE_NEWUSER>."
2637
2638 #. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8
2639 #. FIXME Explain the rationale for this limit. (What is the rationale?)
2640 #. type: Plain text
2641 #: debian-trixie fedora-44 fedora-rawhide
2642 msgid ""
2643 "The kernel imposes (since Linux 3.11) a limit of 32 nested levels of user "
2644 "namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this "
2645 "limit to be exceeded fail with the error B<EUSERS>."
2646 msgstr ""
2647 "يفرض النواة (منذ لينكس 3.11) حدًا أقصى يبلغ 32 مستوى متداخلًا من مساحات أسماء "
2648 "المستخدمين. تفشل استدعاءات B<unshare>(2) أو B<clone>(2) التي قد تتسبب في "
2649 "تجاوز هذا الحد مع الخطأ B<EUSERS>."
2650
2651 #
2652 #. ============================================================
2653 #. type: Plain text
2654 #: debian-trixie fedora-44 fedora-rawhide
2655 msgid ""
2656 "A task that changes one of its effective IDs will have its dumpability reset "
2657 "to the value in I</proc/sys/fs/suid_dumpable>. This may affect the "
2658 "ownership of proc files of child processes and may thus cause the parent to "
2659 "lack the permissions to write to mapping files of child processes running in "
2660 "a new user namespace. In such cases making the parent process dumpable, "
2661 "using B<PR_SET_DUMPABLE> in a call to B<prctl>(2), before creating a child "
2662 "process in a new user namespace may rectify this problem. See B<prctl>(2) "
2663 "and B<proc>(5) for details on how ownership is affected."
2664 msgstr ""
2665 "المهمة التي تغير أحد معرفاتها الفعالة ستعيد تعيين قابلية التفريغ الخاصة بها "
2666 "إلى القيمة في I</proc/sys/fs/suid_dumpable>. قد يؤثر هذا على ملكية ملفات "
2667 "proc للعمليات الفرعية وقد يتسبب بالتالي في افتقار العملية الأب للأذونات "
2668 "اللازمة للكتابة إلى ملفات التعيين للعمليات الفرعية التي تعمل في مساحة اسم "
2669 "مستخدم جديدة. في مثل هذه الحالات، جعل العملية الأب قابلة للتفريغ، باستخدام "
2670 "B<PR_SET_DUMPABLE> في استدعاء B<prctl>(2)، قبل إنشاء عملية فرعية في مساحة "
2671 "اسم مستخدم جديدة قد يصحح هذه المشكلة. انظر B<prctl>(2) و B<proc>(5) "
2672 "للحصول على تفاصيل حول كيفية تأثر الملكية."
2673
2674 #. type: Plain text
2675 #: debian-trixie fedora-44 fedora-rawhide
2676 msgid ""
2677 "A call to B<clone>(2) or B<unshare>(2) using the B<CLONE_NEWUSER> flag or "
2678 "a call to B<setns>(2) that moves the caller into another user namespace "
2679 "sets the \"securebits\" flags (see B<capabilities>(7)) to their default "
2680 "values (all flags disabled) in the child (for B<clone>(2)) or caller (for "
2681 "B<unshare>(2) or B<setns>(2)). Note that because the caller no longer has "
2682 "capabilities in its original user namespace after a call to B<setns>(2), it "
2683 "is not possible for a process to reset its \"securebits\" flags while "
2684 "retaining its user namespace membership by using a pair of B<setns>(2) "
2685 "calls to move to another user namespace and then return to its original user "
2686 "namespace."
2687 msgstr ""
2688 "استدعاء B<clone>(2) أو B<unshare>(2) باستخدام العلم B<CLONE_NEWUSER> أو "
2689 "استدعاء B<setns>(2) الذي ينقل المستدعي إلى مساحة اسم مستخدم أخرى يضبط أعلام "
2690 "\"securebits\" (انظر B<capabilities>(7)) على قيمها المبدئية (جميع الأعلام "
2691 "معطلة) في الفرع (لـ B<clone>(2)) أو المستدعي (لـ B<unshare>(2) أو "
2692 "B<setns>(2)). لاحظ أنه نظرًا لأن المستدعي لم يعد يمتلك صلاحيات في مساحة اسم "
2693 "المستخدم الأصلية بعد استدعاء B<setns>(2)، فليس من الممكن لعملية إعادة تعيين "
2694 "أعلام \"securebits\" الخاصة بها مع الاحتفاظ بعضويتها في مساحة اسم المستخدم "
2695 "باستخدام زوج من استدعاءات B<setns>(2) للانتقال إلى مساحة اسم مستخدم أخرى ثم "
2696 "العودة إلى مساحة اسم المستخدم الأصلية."
2697
2698 #. type: Plain text
2699 #: debian-trixie fedora-44 fedora-rawhide
2700 msgid ""
2701 "If a process has a capability in a user namespace, then it has that "
2702 "capability in all child (and further removed descendant) namespaces as well."
2703 msgstr ""
2704 "إذا كانت العملية تمتلك صلاحية في مساحة اسم مستخدم، فإنها تمتلك تلك الصلاحية "
2705 "في جميع مساحات الأسماء الفرعية (والسليلة البعيدة) أيضًا."
2706
2707 #. type: Plain text
2708 #: debian-trixie fedora-44 fedora-rawhide
2709 msgid ""
2710 "Having a capability inside a user namespace permits a process to perform "
2711 "operations (that require privilege) only on resources governed by that "
2712 "namespace. In other words, having a capability in a user namespace permits "
2713 "a process to perform privileged operations on resources that are governed by "
2714 "(nonuser) namespaces owned by (associated with) the user namespace (see the "
2715 "next subsection)."
2716 msgstr ""
2717 "امتلاك صلاحية داخل مساحة اسم مستخدم يسمح للعملية بتنفيذ عمليات (تتطلب "
2718 "امتيازًا) فقط على الموارد التي تحكمها تلك المساحة. بمعنى آخر، امتلاك صلاحية "
2719 "في مساحة اسم مستخدم يسمح للعملية بتنفيذ عمليات مميزة على الموارد التي تحكمها "
2720 "مساحات أسماء (غير مستخدم) مملوكة (مرتبطة) بمساحة اسم المستخدم (انظر القسم "
2721 "الفرعي التالي)."
2722
2723 #. type: Plain text
2724 #: debian-trixie
2725 msgid ""
2726 "Holding B<CAP_SYS_ADMIN> within the user namespace that owns a process's "
2727 "cgroup namespace allows (since Linux 4.6) that process to the mount the "
2728 "cgroup version 2 filesystem and cgroup version 1 named hierarchies (i.e., "
2729 "cgroup filesystems mounted with the I<\\[dq]none,name=\\[dq]> option)."
2730 msgstr ""
2731 "امتلاك B<CAP_SYS_ADMIN> داخل مساحة اسم المستخدم التي تملك مساحة اسم cgroup "
2732 "لعملية يسمح (منذ لينكس 4.6) لتلك العملية بوصل نظام ملفات cgroup الإصدار 2 "
2733 "والتسلسلات الهرمية المسماة لـ cgroup الإصدار 1 (أي أنظمة ملفات cgroup "
2734 "الموصولة مع الخيار I<\\[dq]none,name=\\[dq]>)."
2735
2736 #
2737 #. ============================================================
2738 #. type: Plain text
2739 #: debian-trixie fedora-44 fedora-rawhide
2740 msgid ""
2741 "Note, however, that mounting block-based filesystems can be done only by a "
2742 "process that holds B<CAP_SYS_ADMIN> in the initial user namespace."
2743 msgstr ""
2744 "لاحظ أن وصل أنظمة الملفات القائمة على الكتل يمكن أن يُنجز فقط بواسطة عملية "
2745 "تمتلك B<CAP_SYS_ADMIN> في مساحة اسم المستخدم الأولية."
2746
2747 #. type: Plain text
2748 #: debian-trixie
2749 msgid ""
2750 "Starting in Linux 3.8, unprivileged processes can create user namespaces, "
2751 "and the other types of namespaces can be created with just the "
2752 "B<CAP_SYS_ADMIN> capability in the caller's user namespace."
2753 msgstr ""
2754 "بدء لينكس 3.8، العمليات غير المميزة يمكنها إنشاء مساحات اسم المستخدم، وأنواع "
2755 "مساحات الأسماء الأخرى يمكن إنشاؤها فقط بقابلية B<CAP_SYS_ADMIN> في مساحة اسم "
2756 "المستخدم للمتصل."
2757
2758 #. type: Plain text
2759 #: debian-trixie fedora-44 fedora-rawhide
2760 msgid ""
2761 "When a new namespace (other than a user namespace) is created via "
2762 "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the "
2763 "creating process as the owner of the new namespace. (This association can't "
2764 "be changed.) When a process in the new namespace subsequently performs "
2765 "privileged operations that operate on global resources isolated by the "
2766 "namespace, the permission checks are performed according to the process's "
2767 "capabilities in the user namespace that the kernel associated with the new "
2768 "namespace. For example, suppose that a process attempts to change the "
2769 "hostname (B<sethostname>(2)), a resource governed by the UTS namespace. In "
2770 "this case, the kernel will determine which user namespace owns the process's "
2771 "UTS namespace, and check whether the process has the required capability "
2772 "(B<CAP_SYS_ADMIN>) in that user namespace."
2773 msgstr ""
2774 "عند إنشاء مساحة اسم جديدة (غير مساحة اسم المستخدم) عبر B<clone>(2) أو "
2775 "B<unshare>(2)، يسجل النواة مساحة اسم المستخدم للعملية المنشئة كمالك لمساحة "
2776 "الاسم الجديدة. (لا يمكن تغيير هذا الارتباط.) عندما تقوم عملية في مساحة الاسم "
2777 "الجديدة لاحقًا بعمليات مميزة تعمل على موارد عالمية معزولة بواسطة مساحة الاسم، "
2778 "يتم إجراء فحوصات الإذن وفقًا لقابليات العملية في مساحة اسم المستخدم التي "
2779 "ربطتها النواة بمساحة الاسم الجديدة. على سبيل المثال، افترض أن عملية تحاول "
2780 "تغيير اسم المضيف (B<sethostname>(2))، وهو مورد محكوم بمساحة اسم UTS. في هذه "
2781 "الحالة، ستحدد النواة أي مساحة اسم مستخدم تملك مساحة اسم UTS للعملية، وتتحقق "
2782 "مما إذا كانت العملية تمتلك القابلية المطلوبة (B<CAP_SYS_ADMIN>) في تلك "
2783 "المساحة."
2784
2785 #. type: Plain text
2786 #: debian-trixie
2787 msgid ""
2788 "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
2789 "contiguous user IDs between two user namespaces. (When a user namespace is "
2790 "first created, this file is empty.) The specification in each line takes "
2791 "the form of three numbers delimited by white space. The first two numbers "
2792 "specify the starting user ID in each of the two user namespaces. The third "
2793 "number specifies the length of the mapped range. In detail, the fields are "
2794 "interpreted as follows:"
2795 msgstr ""
2796 "كل سطر في ملف I<uid_map> يحدد تعيينًا 1-إلى-1 لنطاق من معرفات المستخدم "
2797 "المتجاورة بين مساحتي اسم مستخدم. (عند إنشاء مساحة اسم المستخدم لأول مرة، هذا "
2798 "الملف فارغ.) التحديد في كل سطر يأخذ شكل ثلاثة أرقام مفصولة بمسافة بيضاء. "
2799 "الرقمان الأولان يحددان معرف المستخدم البادئ في كل من مساحتي اسم المستخدم. "
2800 "الرقم الثالث يحدد طول النطاق المعين. بالتفصيل، الحقول تُفسر كالتالي:"
2801
2802 #. type: Plain text
2803 #: debian-trixie
2804 msgid ""
2805 "The length of the range of user IDs that is mapped between the two user "
2806 "namespaces."
2807 msgstr "طول نطاق معرفات المستخدم الذي يُعيّن بين مساحتي اسم المستخدم."
2808
2809 #. type: Plain text
2810 #: debian-trixie fedora-44 fedora-rawhide
2811 msgid ""
2812 "The initial user namespace has no parent namespace, but, for consistency, "
2813 "the kernel provides dummy user and group ID mapping files for this "
2814 "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a "
2815 "shell in the initial namespace shows:"
2816 msgstr ""
2817 "مساحة اسم المستخدم الأولية ليس لها مساحة اسم أم، لكن، من أجل الاتساق، توفر "
2818 "النواة ملفات تعيين معرف مستخدم ومجموعة وهمية لهذه المساحة. النظر إلى ملف "
2819 "I<uid_map> (I<gid_map> هو نفسه) من شل في المساحة الأولية يُظهر:"
2820
2821 #. type: Plain text
2822 #: debian-trixie fedora-44 fedora-rawhide
2823 #, no-wrap
2824 msgid ""
2825 "$ B<cat /proc/$$/uid_map>\n"
2826 " 0 0 4294967295\n"
2827 msgstr ""
2828 "$ B<cat /proc/$$/uid_map>\n"
2829 " 0 0 4294967295\n"
2830
2831 #. ============================================================
2832 #. type: Plain text
2833 #: debian-trixie
2834 #| msgid ""
2835 #| "This mapping tells us that the range starting at user ID 0 in this "
2836 #| "namespace maps to a range starting at 0 in the (nonexistent) parent "
2837 #| "namespace, and the length of the range is the largest 32-bit unsigned "
2838 #| "integer. This leaves 4294967295 (the 32-bit signed -1 value) unmapped. "
2839 #| "This is deliberate: I<(uid_t)\\~-1> is used in several interfaces (e.g., "
2840 #| "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving "
2841 #| "I<(uid_t)\\~-1> unmapped and unusable guarantees that there will be no "
2842 #| "confusion when using these interfaces."
2843 msgid ""
2844 "This mapping tells us that the range starting at user ID 0 in this namespace "
2845 "maps to a range starting at 0 in the (nonexistent) parent namespace, and the "
2846 "length of the range is the largest 32-bit unsigned integer. This leaves "
2847 "4294967295 (the 32-bit signed -1 value) unmapped. This is deliberate: "
2848 "I<(uid_t)\\ -1> is used in several interfaces (e.g., B<setreuid>(2)) as a "
2849 "way to specify \"no user ID\". Leaving I<(uid_t)\\ -1> unmapped and "
2850 "unusable guarantees that there will be no confusion when using these "
2851 "interfaces."
2852 msgstr ""
2853 "يخبرنا هذا التعيين أن النطاق الذي يبدأ بمعرف المستخدم 0 في هذا النطاق الاسمي "
2854 "يُعيّن إلى نطاق يبدأ بـ 0 في النطاق الاسمي الأصلي (غير الموجود)، وطول النطاق "
2855 "هو أكبر عدد صحيح غير موقّع 32 بت. هذا يترك 4294967295 (القيمة -1 الموقّعة 32 "
2856 "بت) غير معيّنة. هذا متعمد: I<(uid_t)\\ -1> يُستخدم في عدة واجهات (مثل "
2857 "B<setreuid>(2)) كطريقة لتحديد \"لا يوجد معرف مستخدم\". ترك I<(uid_t)\\ -1> "
2858 "غير معيّنة وغير قابلة للاستخدام يضمن عدم حدوث ارتباك عند استخدام هذه الواجهات."
2859
2860 #. 5*12-byte records could fit in a 64B cache line
2861 #. commit 6397fac4915ab3002dc15aae751455da1a852f25
2862 #. type: Plain text
2863 #: debian-trixie fedora-44 fedora-rawhide
2864 msgid ""
2865 "There is a limit on the number of lines in the file. In Linux 4.14 and "
2866 "earlier, this limit was (arbitrarily) set at 5 lines. Since Linux 4.15, "
2867 "the limit is 340 lines. In addition, the number of bytes written to the "
2868 "file must be less than the system page size, and the write must be performed "
2869 "at the start of the file (i.e., B<lseek>(2) and B<pwrite>(2) can't be used "
2870 "to write to nonzero offsets in the file)."
2871 msgstr ""
2872 "يوجد حد لعدد الأسطر في الملف. في لينكس 4.14 وما قبله، كان هذا الحد (بشكل "
2873 "تعسفي) مضبوطًا على 5 أسطر. منذ لينكس 4.15، أصبح الحد 340 سطرًا. بالإضافة"
2874 " إلى "
2875 "ذلك، يجب أن يكون عدد البايتات المكتوبة إلى الملف أقل من حجم صفحة النظام، "
2876 "ويجب إجراء الكتابة في بداية الملف (أي لا يمكن استخدام B<lseek>(2) و "
2877 "B<pwrite>(2) للكتابة إلى إزاحات غير صفرية في الملف)."
2878
2879 #. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba
2880 #. type: Plain text
2881 #: debian-trixie fedora-44 fedora-rawhide
2882 msgid ""
2883 "The range of user IDs (group IDs) specified in each line cannot overlap "
2884 "with the ranges in any other lines. In the initial implementation (Linux "
2885 "3.8), this requirement was satisfied by a simplistic implementation that "
2886 "imposed the further requirement that the values in both field 1 and field 2 "
2887 "of successive lines must be in ascending numerical order, which prevented "
2888 "some otherwise valid maps from being created. Linux 3.9 and later fix this "
2889 "limitation, allowing any valid set of nonoverlapping maps."
2890 msgstr ""
2891 "لا يمكن أن يتداخل نطاق معرفات المستخدم (معرفات المجموعة) المحدد في كل سطر مع "
2892 "النطاقات في أي أسطر أخرى. في التطبيق الأولي (لينكس 3.8)، تم تلبية هذا "
2893 "المطلب من خلال تطبيق مبسط فرض مطلبًا إضافيًا بأن القيم في كل من الحقل 1"
2894 " والحقل "
2895 "2 من الأسطر المتتالية يجب أن تكون بترتيب تصاعدي عددي، مما منع إنشاء بعض "
2896 "الخرائط الصالحة بخلاف ذلك. أُصلح هذا التقييد في لينكس 3.9،وما بعده، مما يسمح "
2897 "بأي مجموعة صالحة من الخرائط غير المتداخلة."
2898
2899 #. type: Plain text
2900 #: debian-trixie fedora-44 fedora-rawhide
2901 msgid ""
2902 "The data written to I<uid_map> (I<gid_map>) must consist of a single line "
2903 "that maps the writing process's effective user ID (group ID) in the parent "
2904 "user namespace to a user ID (group ID) in the user namespace."
2905 msgstr ""
2906 "يجب أن تتكون البيانات المكتوبة إلى I<uid_map> (I<gid_map>) من سطر واحد يُعيّن "
2907 "معرف المستخدم الفعال (معرف المجموعة) لعملية الكتابة في النطاق الاسمي "
2908 "للمستخدم الأصلي إلى معرف مستخدم (معرف مجموعة) في النطاق الاسمي للمستخدم."
2909
2910 #. type: Plain text
2911 #: debian-trixie fedora-44 fedora-rawhide
2912 msgid ""
2913 "In the case of I<gid_map>, use of the B<setgroups>(2) system call must "
2914 "first be denied by writing \\[dq]I<deny>\\[dq] to the I</proc/>pidI</"
2915 "setgroups> file (see below) before writing to I<gid_map>."
2916 msgstr ""
2917 "في حالة I<gid_map>، يجب أولاً رفض استخدام استدعاء النظام B<setgroups>(2) عن "
2918 "طريق كتابة \\[dq]I<deny>\\[dq] إلى ملف I</proc/>pidI</setgroups> (انظر "
2919 "أدناه) قبل الكتابة إلى I<gid_map>."
2920
2921 #. type: SS
2922 #: debian-trixie fedora-44 fedora-rawhide
2923 #, no-wrap
2924 msgid "The I</proc/>pidI</setgroups> file"
2925 msgstr "ملف I</proc/>pidI</setgroups>"
2926
2927 #. type: Plain text
2928 #: debian-trixie fedora-44 fedora-rawhide
2929 msgid ""
2930 "A privileged process (one with the B<CAP_SYS_ADMIN> capability in the "
2931 "namespace) may write either of the strings \\[dq]I<allow>\\[dq] or "
2932 "\\[dq]I<deny>\\[dq] to this file I<before> writing a group ID mapping for "
2933 "this user namespace to the file I</proc/>pidI</gid_map>. Writing the string "
2934 "\\[dq]I<deny>\\[dq] prevents any process in the user namespace from "
2935 "employing B<setgroups>(2)."
2936 msgstr ""
2937 "يمكن لعملية متميزة (تلك التي تمتلك قدرة B<CAP_SYS_ADMIN> في النطاق) كتابة أي "
2938 "من السلسلتين \\[dq]I<allow>\\[dq] أو \\[dq]I<deny>\\[dq] إلى هذا الملف "
2939 "I<قبل> كتابة تعيين معرف مجموعة لهذا النطاق المستخدم إلى الملف I</proc/>pidI</"
2940 "gid_map>. كتابة السلسلة \\[dq]I<deny>\\[dq] تمنع أي عملية في النطاق "
2941 "المستخدم من استخدام B<setgroups>(2)."
2942
2943 #. type: Plain text
2944 #: debian-trixie fedora-44 fedora-rawhide
2945 msgid ""
2946 "If the I<setgroups> file has the value \\[dq]I<deny>\\[dq], then the "
2947 "B<setgroups>(2) system call can't subsequently be reenabled (by writing "
2948 "\\[dq]I<allow>\\[dq] to the file) in this user namespace. (Attempts to do "
2949 "so fail with the error B<EPERM>.) This restriction also propagates down to "
2950 "all child user namespaces of this user namespace."
2951 msgstr ""
2952 "إذا كان ملف I<setgroups> يحمل القيمة \\[dq]I<deny>\\[dq]، فلا يمكن إعادة "
2953 "تمكين استدعاء النظام B<setgroups>(2) لاحقًا (عن طريق كتابة "
2954 "\\[dq]I<allow>\\[dq] إلى الملف) في هذا النطاق المستخدم. (تفشل محاولات "
2955 "القيام بذلك مع الخطأ B<EPERM>.) ينتشر هذا التقييد أيضًا إلى جميع نطاقات "
2956 "المستخدم الفرعية لهذا النطاق المستخدم."
2957
2958 #
2959 #
2960 #
2961 #
2962 #. /proc/PID/setgroups
2963 #. [allow == setgroups() is allowed, "deny" == setgroups() is disallowed]
2964 #. * Can write if have CAP_SYS_ADMIN in NS
2965 #. * Must write BEFORE writing to /proc/PID/gid_map
2966 #. setgroups()
2967 #. * Must already have written to gid_map
2968 #. * /proc/PID/setgroups must be "allow"
2969 #. /proc/PID/gid_map -- writing
2970 #. * Must already have written "deny" to /proc/PID/setgroups
2971 #. ============================================================
2972 #. type: Plain text
2973 #: debian-trixie fedora-44 fedora-rawhide
2974 msgid ""
2975 "The I</proc/>pidI</setgroups> file was added in Linux 3.19, but was "
2976 "backported to many earlier stable kernel series, because it addresses a "
2977 "security issue. The issue concerned files with permissions such as \"rwx---"
2978 "rwx\". Such files give fewer permissions to \"group\" than they do to "
2979 "\"other\". This means that dropping groups using B<setgroups>(2) might "
2980 "allow a process file access that it did not formerly have. Before the "
2981 "existence of user namespaces this was not a concern, since only a privileged "
2982 "process (one with the B<CAP_SETGID> capability) could call B<setgroups>(2). "
2983 "However, with the introduction of user namespaces, it became possible for an "
2984 "unprivileged process to create a new namespace in which the user had all "
2985 "privileges. This then allowed formerly unprivileged users to drop groups "
2986 "and thus gain file access that they did not previously have. The I</proc/"
2987 ">pidI</setgroups> file was added to address this security issue, by denying "
2988 "any pathway for an unprivileged process to drop groups with B<setgroups>(2)."
2989 msgstr ""
2990 "تمت إضافة ملف I</proc/>pidI</setgroups> في Linux 3.19، ولكن تم نقله إلى "
2991 "العديد من سلاسل النواة المستقرة السابقة، لأنه يعالج مشكلة أمنية. تعلقت "
2992 "المشكلة بالملفات ذات الأذونات مثل \"rwx---rwx\". تمنح هذه الملفات أذونات "
2993 "أقل لـ \"group\" مقارنة بـ \"other\". هذا يعني أن إسقاط المجموعات باستخدام "
2994 "B<setgroups>(2) قد يسمح لعملية بالوصول إلى ملف لم يكن لديها من قبل. قبل "
2995 "وجود نطاقات المستخدم، لم يكن هذا مصدر قلق، لأن عملية متميزة فقط (تلك التي "
2996 "تمتلك قدرة B<CAP_SETGID>) يمكنها استدعاء B<setgroups>(2). ومع ذلك، مع إدخال "
2997 "نطاقات المستخدم، أصبح من الممكن لعملية غير متميزة إنشاء نطاق جديد يتمتع فيه "
2998 "المستخدم بجميع الامتيازات. سمح هذا بعد ذلك للمستخدمين غير المتميزين سابقًا "
2999 "بإسقاط المجموعات وبالتالي الحصول على وصول إلى الملفات لم يكن لديهم من قبل. "
3000 "تمت إضافة ملف I</proc/>pidI</setgroups> لمعالجة هذه المشكلة الأمنية، عن طريق "
3001 "رفض أي مسار لعملية غير متميزة لإسقاط المجموعات باستخدام B<setgroups>(2)."
3002
3003 #. type: Plain text
3004 #: debian-trixie fedora-44 fedora-rawhide
3005 #, no-wrap
3006 msgid ""
3007 "$ B<uname -rs> # Need Linux 3.8 or later\n"
3008 "Linux 3.8.0\n"
3009 "$ B<id -u> # Running as unprivileged user\n"
3010 "1000\n"
3011 "$ B<id -g>\n"
3012 "1000\n"
3013 msgstr ""
3014 "$ B<uname -rs> # Need Linux 3.8 or later\n"
3015 "Linux 3.8.0\n"
3016 "$ B<id -u> # Running as unprivileged user\n"
3017 "1000\n"
3018 "$ B<id -g>\n"
3019 "1000\n"
3020
3021 #. type: Plain text
3022 #: debian-trixie fedora-44 fedora-rawhide
3023 #, no-wrap
3024 msgid ""
3025 "$ B<./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000"
3026 " 1\\[aq] bash>\n"
3027 msgstr ""
3028 "$ B<./userns_child_exec -p -m -U -M \\[aq]0 1000 1\\[aq] -G \\[aq]0 1000"
3029 " 1\\[aq] bash>\n"
3030
3031 #. type: Plain text
3032 #: debian-trixie fedora-44 fedora-rawhide
3033 #, no-wrap
3034 msgid ""
3035 "bash$ B<echo $$>\n"
3036 "1\n"
3037 msgstr ""
3038 "bash$ B<echo $$>\n"
3039 "1\n"
3040
3041 #. type: Plain text
3042 #: debian-trixie fedora-44 fedora-rawhide
3043 #, no-wrap
3044 msgid ""
3045 "bash$ B<mount -t proc proc /proc>\n"
3046 "bash$ B<ps ax>\n"
3047 " PID TTY STAT TIME COMMAND\n"
3048 " 1 pts/3 S 0:00 bash\n"
3049 " 22 pts/3 R+ 0:00 ps ax\n"
3050 msgstr ""
3051 "bash$ B<mount -t proc proc /proc>\n"
3052 "bash$ B<ps ax>\n"
3053 " PID TTY STAT TIME COMMAND\n"
3054 " 1 pts/3 S 0:00 bash\n"
3055 " 22 pts/3 R+ 0:00 ps ax\n"
3056
3057 #. type: Plain text
3058 #: debian-trixie fedora-44 fedora-rawhide
3059 #, no-wrap
3060 msgid ""
3061 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>\n"
3062 "Uid:\t0\t0\t0\t0\n"
3063 "Gid:\t0\t0\t0\t0\n"
3064 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>\n"
3065 "CapInh:\t0000000000000000\n"
3066 "CapPrm:\t0000001fffffffff\n"
3067 "CapEff:\t0000001fffffffff\n"
3068 msgstr ""
3069 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha][UG]id\\[aq]>\n"
3070 "Uid:\t0\t0\t0\t0\n"
3071 "Gid:\t0\t0\t0\t0\n"
3072 "bash$ B<cat /proc/$$/status | egrep \\[aq]\\[ha]Cap(Prm|Inh|Eff)\\[aq]>\n"
3073 "CapInh:\t0000000000000000\n"
3074 "CapPrm:\t0000001fffffffff\n"
3075 "CapEff:\t0000001fffffffff\n"
3076
3077 #. type: Plain text
3078 #: debian-trixie
3079 #, no-wrap
3080 msgid ""
3081 "/* userns_child_exec.c\n"
3082 "\\&\n"
3083 " Licensed under GNU General Public License v2 or later\n"
3084 "\\&\n"
3085 " Create a child process that executes a shell command in new\n"
3086 " namespace(s); allow UID and GID mappings to be specified when\n"
3087 " creating a user namespace.\n"
3088 "*/\n"
3089 "#define _GNU_SOURCE\n"
3090 "#include E<lt>err.hE<gt>\n"
3091 "#include E<lt>sched.hE<gt>\n"
3092 "#include E<lt>unistd.hE<gt>\n"
3093 "#include E<lt>stdint.hE<gt>\n"
3094 "#include E<lt>stdlib.hE<gt>\n"
3095 "#include E<lt>sys/wait.hE<gt>\n"
3096 "#include E<lt>signal.hE<gt>\n"
3097 "#include E<lt>fcntl.hE<gt>\n"
3098 "#include E<lt>stdio.hE<gt>\n"
3099 "#include E<lt>string.hE<gt>\n"
3100 "#include E<lt>limits.hE<gt>\n"
3101 "#include E<lt>errno.hE<gt>\n"
3102 "\\&\n"
3103 "struct child_args {\n"
3104 " char **argv; /* Command to be executed by child, with args */\n"
3105 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
3106 "};\n"
3107 "\\&\n"
3108 "static int verbose;\n"
3109 "\\&\n"
3110 "static void\n"
3111 "usage(char *pname)\n"
3112 "{\n"
3113 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
3114 " pname);\n"
3115 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
3116 " \"command in a new user namespace,\\[rs]n\"\n"
3117 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
3118 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
3119 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
3120 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
3121 " fpe(\"-m New mount namespace\\[rs]n\");\n"
3122 " fpe(\"-n New network namespace\\[rs]n\");\n"
3123 " fpe(\"-p New PID namespace\\[rs]n\");\n"
3124 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
3125 " fpe(\"-U New user namespace\\[rs]n\");\n"
3126 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
3127 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
3128 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
3129 " namespace\\[rs]n\");\n"
3130 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
3131 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
3132 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
3133 " fpe(\"\\[rs]n\");\n"
3134 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
3135 " fpe(\"It is not permitted to specify both -z and either -M or"
3136 " -G.\\[rs]n\");\n"
3137 " fpe(\"\\[rs]n\");\n"
3138 " fpe(\"Map strings for -M and -G consist of records of the"
3139 " form:\\[rs]n\");\n"
3140 " fpe(\"\\[rs]n\");\n"
3141 " fpe(\" ID-inside-ns ID-outside-ns len\\[rs]n\");\n"
3142 " fpe(\"\\[rs]n\");\n"
3143 " fpe(\"A map string can contain multiple records, separated\"\n"
3144 " \" by commas;\\[rs]n\");\n"
3145 " fpe(\"the commas are replaced by newlines before writing\"\n"
3146 " \" to map files.\\[rs]n\");\n"
3147 "\\&\n"
3148 " exit(EXIT_FAILURE);\n"
3149 "}\n"
3150 "\\&\n"
3151 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
3152 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
3153 " GID mapping consists of one or more newline-delimited records\n"
3154 " of the form:\n"
3155 "\\&\n"
3156 " ID_inside-ns ID-outside-ns length\n"
3157 "\\&\n"
3158 " Requiring the user to supply a string that contains newlines is\n"
3159 " of course inconvenient for command-line use. Thus, we permit the\n"
3160 " use of commas to delimit records in this string, and replace them\n"
3161 " with newlines before writing the string to the file. */\n"
3162 "\\&\n"
3163 "static void\n"
3164 "update_map(char *mapping, char *map_file)\n"
3165 "{\n"
3166 " int fd;\n"
3167 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
3168 "\\&\n"
3169 " /* Replace commas in mapping string with newlines. */\n"
3170 "\\&\n"
3171 " map_len = strlen(mapping);\n"
3172 " for (size_t j = 0; j E<lt> map_len; j++)\n"
3173 " if (mapping[j] == \\[aq],\\[aq])\n"
3174 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
3175 "\\&\n"
3176 " fd = open(map_file, O_RDWR);\n"
3177 " if (fd == -1) {\n"
3178 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
3179 " strerror(errno));\n"
3180 " exit(EXIT_FAILURE);\n"
3181 " }\n"
3182 "\\&\n"
3183 " if (write(fd, mapping, map_len) != map_len) {\n"
3184 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
3185 " strerror(errno));\n"
3186 " exit(EXIT_FAILURE);\n"
3187 " }\n"
3188 "\\&\n"
3189 " close(fd);\n"
3190 "}\n"
3191 "\\&\n"
3192 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
3193 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
3194 " allowed *unprivileged* users to employ user namespaces in\n"
3195 " order to drop groups. The upshot of the 3.19 changes is that\n"
3196 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
3197 " system call in this user namespace must first be disabled by\n"
3198 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
3199 " this namespace. That is the purpose of the following function. */\n"
3200 "\\&\n"
3201 "static void\n"
3202 "proc_setgroups_write(pid_t child_pid, char *str)\n"
3203 "{\n"
3204 " char setgroups_path[PATH_MAX];\n"
3205 " int fd;\n"
3206 "\\&\n"
3207 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
3208 " (intmax_t) child_pid);\n"
3209 "\\&\n"
3210 " fd = open(setgroups_path, O_RDWR);\n"
3211 " if (fd == -1) {\n"
3212 "\\&\n"
3213 " /* We may be on a system that doesn\\[aq]t support\n"
3214 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
3215 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
3216 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
3217 " order\n"
3218 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
3219 "\\&\n"
3220 " However, if the error from open() was something other than\n"
3221 " the ENOENT error that is expected for that case, let the\n"
3222 " user know. */\n"
3223 "\\&\n"
3224 " if (errno != ENOENT)\n"
3225 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
3226 " strerror(errno));\n"
3227 " return;\n"
3228 " }\n"
3229 "\\&\n"
3230 " if (write(fd, str, strlen(str)) == -1)\n"
3231 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
3232 " strerror(errno));\n"
3233 "\\&\n"
3234 " close(fd);\n"
3235 "}\n"
3236 "\\&\n"
3237 "static int /* Start function for cloned child */\n"
3238 "childFunc(void *arg)\n"
3239 "{\n"
3240 " struct child_args *args = arg;\n"
3241 " char ch;\n"
3242 "\\&\n"
3243 " /* Wait until the parent has updated the UID and GID mappings.\n"
3244 " See the comment in main(). We wait for end of file on a\n"
3245 " pipe that will be closed by the parent process once it has\n"
3246 " updated the mappings. */\n"
3247 "\\&\n"
3248 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
3249 " end of the pipe so that we see EOF\n"
3250 " when parent closes its descriptor. */\n"
3251 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
3252 " fprintf(stderr,\n"
3253 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
3254 " exit(EXIT_FAILURE);\n"
3255 " }\n"
3256 "\\&\n"
3257 " close(args-E<gt>pipe_fd[0]);\n"
3258 "\\&\n"
3259 " /* Execute a shell command. */\n"
3260 "\\&\n"
3261 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
3262 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
3263 " err(EXIT_FAILURE, \"execvp\");\n"
3264 "}\n"
3265 "\\&\n"
3266 "#define STACK_SIZE (1024 * 1024)\n"
3267 "\\&\n"
3268 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
3269 "\\&\n"
3270 "int\n"
3271 "main(int argc, char *argv[])\n"
3272 "{\n"
3273 " int flags, opt, map_zero;\n"
3274 " pid_t child_pid;\n"
3275 " struct child_args args;\n"
3276 " char *uid_map, *gid_map;\n"
3277 " const int MAP_BUF_SIZE = 100;\n"
3278 " char map_buf[MAP_BUF_SIZE];\n"
3279 " char map_path[PATH_MAX];\n"
3280 "\\&\n"
3281 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
3282 " the final getopt() argument prevents GNU-style permutation\n"
3283 " of command-line options. That\\[aq]s useful, since sometimes\n"
3284 " the \\[aq]command\\[aq] to be executed by this program itself\n"
3285 " has command-line options. We don\\[aq]t want getopt() to treat\n"
3286 " those as options to this program. */\n"
3287 "\\&\n"
3288 " flags = 0;\n"
3289 " verbose = 0;\n"
3290 " gid_map = NULL;\n"
3291 " uid_map = NULL;\n"
3292 " map_zero = 0;\n"
3293 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
3294 " switch (opt) {\n"
3295 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
3296 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
3297 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
3298 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
3299 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
3300 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
3301 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
3302 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
3303 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
3304 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
3305 " default: usage(argv[0]);\n"
3306 " }\n"
3307 " }\n"
3308 "\\&\n"
3309 " /* -M or -G without -U is nonsensical */\n"
3310 "\\&\n"
3311 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
3312 " !(flags & CLONE_NEWUSER)) ||\n"
3313 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
3314 " usage(argv[0]);\n"
3315 "\\&\n"
3316 " args.argv = &argv[optind];\n"
3317 "\\&\n"
3318 " /* We use a pipe to synchronize the parent and child, in order to\n"
3319 " ensure that the parent sets the UID and GID maps before the child\n"
3320 " calls execve(). This ensures that the child maintains its\n"
3321 " capabilities during the execve() in the common case where we\n"
3322 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
3323 " namespace. Without this synchronization, the child would lose\n"
3324 " its capabilities if it performed an execve() with nonzero\n"
3325 " user IDs (see the capabilities(7) man page for details of the\n"
3326 " transformation of a process\\[aq]s capabilities during execve()). */\n"
3327 "\\&\n"
3328 " if (pipe(args.pipe_fd) == -1)\n"
3329 " err(EXIT_FAILURE, \"pipe\");\n"
3330 "\\&\n"
3331 " /* Create the child in new namespace(s). */\n"
3332 "\\&\n"
3333 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
3334 " flags | SIGCHLD, &args);\n"
3335 " if (child_pid == -1)\n"
3336 " err(EXIT_FAILURE, \"clone\");\n"
3337 "\\&\n"
3338 " /* Parent falls through to here. */\n"
3339 "\\&\n"
3340 " if (verbose)\n"
3341 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
3342 " argv[0], (intmax_t) child_pid);\n"
3343 "\\&\n"
3344 " /* Update the UID and GID maps in the child. */\n"
3345 "\\&\n"
3346 " if (uid_map != NULL || map_zero) {\n"
3347 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
3348 " (intmax_t) child_pid);\n"
3349 " if (map_zero) {\n"
3350 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
3351 " (intmax_t) getuid());\n"
3352 " uid_map = map_buf;\n"
3353 " }\n"
3354 " update_map(uid_map, map_path);\n"
3355 " }\n"
3356 "\\&\n"
3357 " if (gid_map != NULL || map_zero) {\n"
3358 " proc_setgroups_write(child_pid, \"deny\");\n"
3359 "\\&\n"
3360 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
3361 " (intmax_t) child_pid);\n"
3362 " if (map_zero) {\n"
3363 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
3364 " (intmax_t) getgid());\n"
3365 " gid_map = map_buf;\n"
3366 " }\n"
3367 " update_map(gid_map, map_path);\n"
3368 " }\n"
3369 "\\&\n"
3370 " /* Close the write end of the pipe, to signal to the child that we\n"
3371 " have updated the UID and GID maps. */\n"
3372 "\\&\n"
3373 " close(args.pipe_fd[1]);\n"
3374 "\\&\n"
3375 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
3376 " err(EXIT_FAILURE, \"waitpid\");\n"
3377 "\\&\n"
3378 " if (verbose)\n"
3379 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
3380 "\\&\n"
3381 " exit(EXIT_SUCCESS);\n"
3382 "}\n"
3383 msgstr ""
3384 "/* userns_child_exec.c\n"
3385 "\\&\n"
3386 " Licensed under GNU General Public License v2 or later\n"
3387 "\\&\n"
3388 " Create a child process that executes a shell command in new\n"
3389 " namespace(s); allow UID and GID mappings to be specified when\n"
3390 " creating a user namespace.\n"
3391 "*/\n"
3392 "#define _GNU_SOURCE\n"
3393 "#include E<lt>err.hE<gt>\n"
3394 "#include E<lt>sched.hE<gt>\n"
3395 "#include E<lt>unistd.hE<gt>\n"
3396 "#include E<lt>stdint.hE<gt>\n"
3397 "#include E<lt>stdlib.hE<gt>\n"
3398 "#include E<lt>sys/wait.hE<gt>\n"
3399 "#include E<lt>signal.hE<gt>\n"
3400 "#include E<lt>fcntl.hE<gt>\n"
3401 "#include E<lt>stdio.hE<gt>\n"
3402 "#include E<lt>string.hE<gt>\n"
3403 "#include E<lt>limits.hE<gt>\n"
3404 "#include E<lt>errno.hE<gt>\n"
3405 "\\&\n"
3406 "struct child_args {\n"
3407 " char **argv; /* Command to be executed by child, with args */\n"
3408 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
3409 "};\n"
3410 "\\&\n"
3411 "static int verbose;\n"
3412 "\\&\n"
3413 "static void\n"
3414 "usage(char *pname)\n"
3415 "{\n"
3416 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
3417 " pname);\n"
3418 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
3419 " \"command in a new user namespace,\\[rs]n\"\n"
3420 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
3421 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
3422 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
3423 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
3424 " fpe(\"-m New mount namespace\\[rs]n\");\n"
3425 " fpe(\"-n New network namespace\\[rs]n\");\n"
3426 " fpe(\"-p New PID namespace\\[rs]n\");\n"
3427 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
3428 " fpe(\"-U New user namespace\\[rs]n\");\n"
3429 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
3430 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
3431 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
3432 " namespace\\[rs]n\");\n"
3433 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
3434 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
3435 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
3436 " fpe(\"\\[rs]n\");\n"
3437 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
3438 " fpe(\"It is not permitted to specify both -z and either -M or"
3439 " -G.\\[rs]n\");\n"
3440 " fpe(\"\\[rs]n\");\n"
3441 " fpe(\"Map strings for -M and -G consist of records of the"
3442 " form:\\[rs]n\");\n"
3443 " fpe(\"\\[rs]n\");\n"
3444 " fpe(\" ID-inside-ns ID-outside-ns len\\[rs]n\");\n"
3445 " fpe(\"\\[rs]n\");\n"
3446 " fpe(\"A map string can contain multiple records, separated\"\n"
3447 " \" by commas;\\[rs]n\");\n"
3448 " fpe(\"the commas are replaced by newlines before writing\"\n"
3449 " \" to map files.\\[rs]n\");\n"
3450 "\\&\n"
3451 " exit(EXIT_FAILURE);\n"
3452 "}\n"
3453 "\\&\n"
3454 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
3455 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
3456 " GID mapping consists of one or more newline-delimited records\n"
3457 " of the form:\n"
3458 "\\&\n"
3459 " ID_inside-ns ID-outside-ns length\n"
3460 "\\&\n"
3461 " Requiring the user to supply a string that contains newlines is\n"
3462 " of course inconvenient for command-line use. Thus, we permit the\n"
3463 " use of commas to delimit records in this string, and replace them\n"
3464 " with newlines before writing the string to the file. */\n"
3465 "\\&\n"
3466 "static void\n"
3467 "update_map(char *mapping, char *map_file)\n"
3468 "{\n"
3469 " int fd;\n"
3470 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
3471 "\\&\n"
3472 " /* Replace commas in mapping string with newlines. */\n"
3473 "\\&\n"
3474 " map_len = strlen(mapping);\n"
3475 " for (size_t j = 0; j E<lt> map_len; j++)\n"
3476 " if (mapping[j] == \\[aq],\\[aq])\n"
3477 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
3478 "\\&\n"
3479 " fd = open(map_file, O_RDWR);\n"
3480 " if (fd == -1) {\n"
3481 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
3482 " strerror(errno));\n"
3483 " exit(EXIT_FAILURE);\n"
3484 " }\n"
3485 "\\&\n"
3486 " if (write(fd, mapping, map_len) != map_len) {\n"
3487 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
3488 " strerror(errno));\n"
3489 " exit(EXIT_FAILURE);\n"
3490 " }\n"
3491 "\\&\n"
3492 " close(fd);\n"
3493 "}\n"
3494 "\\&\n"
3495 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
3496 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
3497 " allowed *unprivileged* users to employ user namespaces in\n"
3498 " order to drop groups. The upshot of the 3.19 changes is that\n"
3499 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
3500 " system call in this user namespace must first be disabled by\n"
3501 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
3502 " this namespace. That is the purpose of the following function. */\n"
3503 "\\&\n"
3504 "static void\n"
3505 "proc_setgroups_write(pid_t child_pid, char *str)\n"
3506 "{\n"
3507 " char setgroups_path[PATH_MAX];\n"
3508 " int fd;\n"
3509 "\\&\n"
3510 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
3511 " (intmax_t) child_pid);\n"
3512 "\\&\n"
3513 " fd = open(setgroups_path, O_RDWR);\n"
3514 " if (fd == -1) {\n"
3515 "\\&\n"
3516 " /* We may be on a system that doesn\\[aq]t support\n"
3517 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
3518 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
3519 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
3520 " order\n"
3521 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
3522 "\\&\n"
3523 " However, if the error from open() was something other than\n"
3524 " the ENOENT error that is expected for that case, let the\n"
3525 " user know. */\n"
3526 "\\&\n"
3527 " if (errno != ENOENT)\n"
3528 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
3529 " strerror(errno));\n"
3530 " return;\n"
3531 " }\n"
3532 "\\&\n"
3533 " if (write(fd, str, strlen(str)) == -1)\n"
3534 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
3535 " strerror(errno));\n"
3536 "\\&\n"
3537 " close(fd);\n"
3538 "}\n"
3539 "\\&\n"
3540 "static int /* Start function for cloned child */\n"
3541 "childFunc(void *arg)\n"
3542 "{\n"
3543 " struct child_args *args = arg;\n"
3544 " char ch;\n"
3545 "\\&\n"
3546 " /* Wait until the parent has updated the UID and GID mappings.\n"
3547 " See the comment in main(). We wait for end of file on a\n"
3548 " pipe that will be closed by the parent process once it has\n"
3549 " updated the mappings. */\n"
3550 "\\&\n"
3551 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
3552 " end of the pipe so that we see EOF\n"
3553 " when parent closes its descriptor. */\n"
3554 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
3555 " fprintf(stderr,\n"
3556 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
3557 " exit(EXIT_FAILURE);\n"
3558 " }\n"
3559 "\\&\n"
3560 " close(args-E<gt>pipe_fd[0]);\n"
3561 "\\&\n"
3562 " /* Execute a shell command. */\n"
3563 "\\&\n"
3564 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
3565 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
3566 " err(EXIT_FAILURE, \"execvp\");\n"
3567 "}\n"
3568 "\\&\n"
3569 "#define STACK_SIZE (1024 * 1024)\n"
3570 "\\&\n"
3571 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
3572 "\\&\n"
3573 "int\n"
3574 "main(int argc, char *argv[])\n"
3575 "{\n"
3576 " int flags, opt, map_zero;\n"
3577 " pid_t child_pid;\n"
3578 " struct child_args args;\n"
3579 " char *uid_map, *gid_map;\n"
3580 " const int MAP_BUF_SIZE = 100;\n"
3581 " char map_buf[MAP_BUF_SIZE];\n"
3582 " char map_path[PATH_MAX];\n"
3583 "\\&\n"
3584 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
3585 " the final getopt() argument prevents GNU-style permutation\n"
3586 " of command-line options. That\\[aq]s useful, since sometimes\n"
3587 " the \\[aq]command\\[aq] to be executed by this program itself\n"
3588 " has command-line options. We don\\[aq]t want getopt() to treat\n"
3589 " those as options to this program. */\n"
3590 "\\&\n"
3591 " flags = 0;\n"
3592 " verbose = 0;\n"
3593 " gid_map = NULL;\n"
3594 " uid_map = NULL;\n"
3595 " map_zero = 0;\n"
3596 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
3597 " switch (opt) {\n"
3598 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
3599 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
3600 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
3601 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
3602 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
3603 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
3604 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
3605 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
3606 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
3607 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
3608 " default: usage(argv[0]);\n"
3609 " }\n"
3610 " }\n"
3611 "\\&\n"
3612 " /* -M or -G without -U is nonsensical */\n"
3613 "\\&\n"
3614 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
3615 " !(flags & CLONE_NEWUSER)) ||\n"
3616 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
3617 " usage(argv[0]);\n"
3618 "\\&\n"
3619 " args.argv = &argv[optind];\n"
3620 "\\&\n"
3621 " /* We use a pipe to synchronize the parent and child, in order to\n"
3622 " ensure that the parent sets the UID and GID maps before the child\n"
3623 " calls execve(). This ensures that the child maintains its\n"
3624 " capabilities during the execve() in the common case where we\n"
3625 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
3626 " namespace. Without this synchronization, the child would lose\n"
3627 " its capabilities if it performed an execve() with nonzero\n"
3628 " user IDs (see the capabilities(7) man page for details of the\n"
3629 " transformation of a process\\[aq]s capabilities during execve()). */\n"
3630 "\\&\n"
3631 " if (pipe(args.pipe_fd) == -1)\n"
3632 " err(EXIT_FAILURE, \"pipe\");\n"
3633 "\\&\n"
3634 " /* Create the child in new namespace(s). */\n"
3635 "\\&\n"
3636 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
3637 " flags | SIGCHLD, &args);\n"
3638 " if (child_pid == -1)\n"
3639 " err(EXIT_FAILURE, \"clone\");\n"
3640 "\\&\n"
3641 " /* Parent falls through to here. */\n"
3642 "\\&\n"
3643 " if (verbose)\n"
3644 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
3645 " argv[0], (intmax_t) child_pid);\n"
3646 "\\&\n"
3647 " /* Update the UID and GID maps in the child. */\n"
3648 "\\&\n"
3649 " if (uid_map != NULL || map_zero) {\n"
3650 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
3651 " (intmax_t) child_pid);\n"
3652 " if (map_zero) {\n"
3653 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
3654 " (intmax_t) getuid());\n"
3655 " uid_map = map_buf;\n"
3656 " }\n"
3657 " update_map(uid_map, map_path);\n"
3658 " }\n"
3659 "\\&\n"
3660 " if (gid_map != NULL || map_zero) {\n"
3661 " proc_setgroups_write(child_pid, \"deny\");\n"
3662 "\\&\n"
3663 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
3664 " (intmax_t) child_pid);\n"
3665 " if (map_zero) {\n"
3666 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
3667 " (intmax_t) getgid());\n"
3668 " gid_map = map_buf;\n"
3669 " }\n"
3670 " update_map(gid_map, map_path);\n"
3671 " }\n"
3672 "\\&\n"
3673 " /* Close the write end of the pipe, to signal to the child that we\n"
3674 " have updated the UID and GID maps. */\n"
3675 "\\&\n"
3676 " close(args.pipe_fd[1]);\n"
3677 "\\&\n"
3678 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
3679 " err(EXIT_FAILURE, \"waitpid\");\n"
3680 "\\&\n"
3681 " if (verbose)\n"
3682 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
3683 "\\&\n"
3684 " exit(EXIT_SUCCESS);\n"
3685 "}\n"
3686
3687 #. type: TH
3688 #: fedora-44 fedora-rawhide
3689 #, no-wrap
3690 msgid "2025-01-11"
3691 msgstr "11 يناير 2025"
3692
3693 #. type: TH
3694 #: fedora-44 fedora-rawhide
3695 #, no-wrap
3696 msgid "Linux man-pages 6.13"
3697 msgstr "صفحات دليل لينكس 6.13"
3698
3699 #. type: Plain text
3700 #: fedora-44 fedora-rawhide
3701 #, no-wrap
3702 msgid ""
3703 "/* userns_child_exec.c\n"
3704 "\\&\n"
3705 " Licensed under GNU General Public License v2 or later\n"
3706 "\\&\n"
3707 " Create a child process that executes a shell command in new\n"
3708 " namespace(s); allow UID and GID mappings to be specified when\n"
3709 " creating a user namespace.\n"
3710 "*/\n"
3711 "#define _GNU_SOURCE\n"
3712 "#include E<lt>err.hE<gt>\n"
3713 "#include E<lt>sched.hE<gt>\n"
3714 "#include E<lt>unistd.hE<gt>\n"
3715 "#include E<lt>stdint.hE<gt>\n"
3716 "#include E<lt>stdlib.hE<gt>\n"
3717 "#include E<lt>sys/wait.hE<gt>\n"
3718 "#include E<lt>signal.hE<gt>\n"
3719 "#include E<lt>fcntl.hE<gt>\n"
3720 "#include E<lt>stdio.hE<gt>\n"
3721 "#include E<lt>string.hE<gt>\n"
3722 "#include E<lt>limits.hE<gt>\n"
3723 "#include E<lt>errno.hE<gt>\n"
3724 "\\&\n"
3725 "struct child_args {\n"
3726 " char **argv; /* Command to be executed by child, with args */\n"
3727 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
3728 "};\n"
3729 "\\&\n"
3730 "static int verbose;\n"
3731 "\\&\n"
3732 "static void\n"
3733 "usage(char *pname)\n"
3734 "{\n"
3735 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
3736 " pname);\n"
3737 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
3738 " \"command in a new user namespace,\\[rs]n\"\n"
3739 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
3740 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
3741 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
3742 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
3743 " fpe(\"-m New mount namespace\\[rs]n\");\n"
3744 " fpe(\"-n New network namespace\\[rs]n\");\n"
3745 " fpe(\"-p New PID namespace\\[rs]n\");\n"
3746 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
3747 " fpe(\"-U New user namespace\\[rs]n\");\n"
3748 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
3749 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
3750 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
3751 " namespace\\[rs]n\");\n"
3752 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
3753 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
3754 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
3755 " fpe(\"\\[rs]n\");\n"
3756 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
3757 " fpe(\"It is not permitted to specify both -z and either -M or"
3758 " -G.\\[rs]n\");\n"
3759 " fpe(\"\\[rs]n\");\n"
3760 " fpe(\"Map strings for -M and -G consist of records of the"
3761 " form:\\[rs]n\");\n"
3762 " fpe(\"\\[rs]n\");\n"
3763 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
3764 " fpe(\"\\[rs]n\");\n"
3765 " fpe(\"A map string can contain multiple records, separated\"\n"
3766 " \" by commas;\\[rs]n\");\n"
3767 " fpe(\"the commas are replaced by newlines before writing\"\n"
3768 " \" to map files.\\[rs]n\");\n"
3769 "\\&\n"
3770 " exit(EXIT_FAILURE);\n"
3771 "}\n"
3772 "\\&\n"
3773 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
3774 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
3775 " GID mapping consists of one or more newline-delimited records\n"
3776 " of the form:\n"
3777 "\\&\n"
3778 " ID_inside-ns ID-outside-ns size\n"
3779 "\\&\n"
3780 " Requiring the user to supply a string that contains newlines is\n"
3781 " of course inconvenient for command-line use. Thus, we permit the\n"
3782 " use of commas to delimit records in this string, and replace them\n"
3783 " with newlines before writing the string to the file. */\n"
3784 "\\&\n"
3785 "static void\n"
3786 "update_map(char *mapping, char *map_file)\n"
3787 "{\n"
3788 " int fd;\n"
3789 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
3790 "\\&\n"
3791 " /* Replace commas in mapping string with newlines. */\n"
3792 "\\&\n"
3793 " map_len = strlen(mapping);\n"
3794 " for (size_t j = 0; j E<lt> map_len; j++)\n"
3795 " if (mapping[j] == \\[aq],\\[aq])\n"
3796 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
3797 "\\&\n"
3798 " fd = open(map_file, O_RDWR);\n"
3799 " if (fd == -1) {\n"
3800 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
3801 " strerror(errno));\n"
3802 " exit(EXIT_FAILURE);\n"
3803 " }\n"
3804 "\\&\n"
3805 " if (write(fd, mapping, map_len) != map_len) {\n"
3806 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
3807 " strerror(errno));\n"
3808 " exit(EXIT_FAILURE);\n"
3809 " }\n"
3810 "\\&\n"
3811 " close(fd);\n"
3812 "}\n"
3813 "\\&\n"
3814 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
3815 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
3816 " allowed *unprivileged* users to employ user namespaces in\n"
3817 " order to drop groups. The upshot of the 3.19 changes is that\n"
3818 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
3819 " system call in this user namespace must first be disabled by\n"
3820 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
3821 " this namespace. That is the purpose of the following function. */\n"
3822 "\\&\n"
3823 "static void\n"
3824 "proc_setgroups_write(pid_t child_pid, char *str)\n"
3825 "{\n"
3826 " char setgroups_path[PATH_MAX];\n"
3827 " int fd;\n"
3828 "\\&\n"
3829 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
3830 " (intmax_t) child_pid);\n"
3831 "\\&\n"
3832 " fd = open(setgroups_path, O_RDWR);\n"
3833 " if (fd == -1) {\n"
3834 "\\&\n"
3835 " /* We may be on a system that doesn\\[aq]t support\n"
3836 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
3837 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
3838 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
3839 " order\n"
3840 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
3841 "\\&\n"
3842 " However, if the error from open() was something other than\n"
3843 " the ENOENT error that is expected for that case, let the\n"
3844 " user know. */\n"
3845 "\\&\n"
3846 " if (errno != ENOENT)\n"
3847 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
3848 " strerror(errno));\n"
3849 " return;\n"
3850 " }\n"
3851 "\\&\n"
3852 " if (write(fd, str, strlen(str)) == -1)\n"
3853 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
3854 " strerror(errno));\n"
3855 "\\&\n"
3856 " close(fd);\n"
3857 "}\n"
3858 "\\&\n"
3859 "static int /* Start function for cloned child */\n"
3860 "childFunc(void *arg)\n"
3861 "{\n"
3862 " struct child_args *args = arg;\n"
3863 " char ch;\n"
3864 "\\&\n"
3865 " /* Wait until the parent has updated the UID and GID mappings.\n"
3866 " See the comment in main(). We wait for end of file on a\n"
3867 " pipe that will be closed by the parent process once it has\n"
3868 " updated the mappings. */\n"
3869 "\\&\n"
3870 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
3871 " end of the pipe so that we see EOF\n"
3872 " when parent closes its descriptor. */\n"
3873 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
3874 " fprintf(stderr,\n"
3875 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
3876 " exit(EXIT_FAILURE);\n"
3877 " }\n"
3878 "\\&\n"
3879 " close(args-E<gt>pipe_fd[0]);\n"
3880 "\\&\n"
3881 " /* Execute a shell command. */\n"
3882 "\\&\n"
3883 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
3884 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
3885 " err(EXIT_FAILURE, \"execvp\");\n"
3886 "}\n"
3887 "\\&\n"
3888 "#define STACK_SIZE (1024 * 1024)\n"
3889 "\\&\n"
3890 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
3891 "\\&\n"
3892 "int\n"
3893 "main(int argc, char *argv[])\n"
3894 "{\n"
3895 " int flags, opt, map_zero;\n"
3896 " pid_t child_pid;\n"
3897 " struct child_args args;\n"
3898 " char *uid_map, *gid_map;\n"
3899 " const int MAP_BUF_SIZE = 100;\n"
3900 " char map_buf[MAP_BUF_SIZE];\n"
3901 " char map_path[PATH_MAX];\n"
3902 "\\&\n"
3903 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
3904 " the final getopt() argument prevents GNU-style permutation\n"
3905 " of command-line options. That\\[aq]s useful, since sometimes\n"
3906 " the \\[aq]command\\[aq] to be executed by this program itself\n"
3907 " has command-line options. We don\\[aq]t want getopt() to treat\n"
3908 " those as options to this program. */\n"
3909 "\\&\n"
3910 " flags = 0;\n"
3911 " verbose = 0;\n"
3912 " gid_map = NULL;\n"
3913 " uid_map = NULL;\n"
3914 " map_zero = 0;\n"
3915 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
3916 " switch (opt) {\n"
3917 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
3918 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
3919 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
3920 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
3921 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
3922 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
3923 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
3924 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
3925 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
3926 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
3927 " default: usage(argv[0]);\n"
3928 " }\n"
3929 " }\n"
3930 "\\&\n"
3931 " /* -M or -G without -U is nonsensical */\n"
3932 "\\&\n"
3933 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
3934 " !(flags & CLONE_NEWUSER)) ||\n"
3935 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
3936 " usage(argv[0]);\n"
3937 "\\&\n"
3938 " args.argv = &argv[optind];\n"
3939 "\\&\n"
3940 " /* We use a pipe to synchronize the parent and child, in order to\n"
3941 " ensure that the parent sets the UID and GID maps before the child\n"
3942 " calls execve(). This ensures that the child maintains its\n"
3943 " capabilities during the execve() in the common case where we\n"
3944 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
3945 " namespace. Without this synchronization, the child would lose\n"
3946 " its capabilities if it performed an execve() with nonzero\n"
3947 " user IDs (see the capabilities(7) man page for details of the\n"
3948 " transformation of a process\\[aq]s capabilities during execve()). */\n"
3949 "\\&\n"
3950 " if (pipe(args.pipe_fd) == -1)\n"
3951 " err(EXIT_FAILURE, \"pipe\");\n"
3952 "\\&\n"
3953 " /* Create the child in new namespace(s). */\n"
3954 "\\&\n"
3955 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
3956 " flags | SIGCHLD, &args);\n"
3957 " if (child_pid == -1)\n"
3958 " err(EXIT_FAILURE, \"clone\");\n"
3959 "\\&\n"
3960 " /* Parent falls through to here. */\n"
3961 "\\&\n"
3962 " if (verbose)\n"
3963 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
3964 " argv[0], (intmax_t) child_pid);\n"
3965 "\\&\n"
3966 " /* Update the UID and GID maps in the child. */\n"
3967 "\\&\n"
3968 " if (uid_map != NULL || map_zero) {\n"
3969 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
3970 " (intmax_t) child_pid);\n"
3971 " if (map_zero) {\n"
3972 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
3973 " (intmax_t) getuid());\n"
3974 " uid_map = map_buf;\n"
3975 " }\n"
3976 " update_map(uid_map, map_path);\n"
3977 " }\n"
3978 "\\&\n"
3979 " if (gid_map != NULL || map_zero) {\n"
3980 " proc_setgroups_write(child_pid, \"deny\");\n"
3981 "\\&\n"
3982 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
3983 " (intmax_t) child_pid);\n"
3984 " if (map_zero) {\n"
3985 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
3986 " (intmax_t) getgid());\n"
3987 " gid_map = map_buf;\n"
3988 " }\n"
3989 " update_map(gid_map, map_path);\n"
3990 " }\n"
3991 "\\&\n"
3992 " /* Close the write end of the pipe, to signal to the child that we\n"
3993 " have updated the UID and GID maps. */\n"
3994 "\\&\n"
3995 " close(args.pipe_fd[1]);\n"
3996 "\\&\n"
3997 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
3998 " err(EXIT_FAILURE, \"waitpid\");\n"
3999 "\\&\n"
4000 " if (verbose)\n"
4001 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
4002 "\\&\n"
4003 " exit(EXIT_SUCCESS);\n"
4004 "}\n"
4005 msgstr ""
4006 "/* userns_child_exec.c\n"
4007 "\\&\n"
4008 " Licensed under GNU General Public License v2 or later\n"
4009 "\\&\n"
4010 " Create a child process that executes a shell command in new\n"
4011 " namespace(s); allow UID and GID mappings to be specified when\n"
4012 " creating a user namespace.\n"
4013 "*/\n"
4014 "#define _GNU_SOURCE\n"
4015 "#include E<lt>err.hE<gt>\n"
4016 "#include E<lt>sched.hE<gt>\n"
4017 "#include E<lt>unistd.hE<gt>\n"
4018 "#include E<lt>stdint.hE<gt>\n"
4019 "#include E<lt>stdlib.hE<gt>\n"
4020 "#include E<lt>sys/wait.hE<gt>\n"
4021 "#include E<lt>signal.hE<gt>\n"
4022 "#include E<lt>fcntl.hE<gt>\n"
4023 "#include E<lt>stdio.hE<gt>\n"
4024 "#include E<lt>string.hE<gt>\n"
4025 "#include E<lt>limits.hE<gt>\n"
4026 "#include E<lt>errno.hE<gt>\n"
4027 "\\&\n"
4028 "struct child_args {\n"
4029 " char **argv; /* Command to be executed by child, with args */\n"
4030 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
4031 "};\n"
4032 "\\&\n"
4033 "static int verbose;\n"
4034 "\\&\n"
4035 "static void\n"
4036 "usage(char *pname)\n"
4037 "{\n"
4038 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\[rs]n\\[rs]n\","
4039 " pname);\n"
4040 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
4041 " \"command in a new user namespace,\\[rs]n\"\n"
4042 " \"and possibly also other new namespace(s).\\[rs]n\\[rs]n\");\n"
4043 " fprintf(stderr, \"Options can be:\\[rs]n\\[rs]n\");\n"
4044 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
4045 " fpe(\"-i New IPC namespace\\[rs]n\");\n"
4046 " fpe(\"-m New mount namespace\\[rs]n\");\n"
4047 " fpe(\"-n New network namespace\\[rs]n\");\n"
4048 " fpe(\"-p New PID namespace\\[rs]n\");\n"
4049 " fpe(\"-u New UTS namespace\\[rs]n\");\n"
4050 " fpe(\"-U New user namespace\\[rs]n\");\n"
4051 " fpe(\"-M uid_map Specify UID map for user namespace\\[rs]n\");\n"
4052 " fpe(\"-G gid_map Specify GID map for user namespace\\[rs]n\");\n"
4053 " fpe(\"-z Map user\\[aq]s UID and GID to 0 in user"
4054 " namespace\\[rs]n\");\n"
4055 " fpe(\" (equivalent to: -M \\[aq]0 E<lt>uidE<gt> 1\\[aq] -G"
4056 " \\[aq]0 E<lt>gidE<gt> 1\\[aq])\\[rs]n\");\n"
4057 " fpe(\"-v Display verbose messages\\[rs]n\");\n"
4058 " fpe(\"\\[rs]n\");\n"
4059 " fpe(\"If -z, -M, or -G is specified, -U is required.\\[rs]n\");\n"
4060 " fpe(\"It is not permitted to specify both -z and either -M or"
4061 " -G.\\[rs]n\");\n"
4062 " fpe(\"\\[rs]n\");\n"
4063 " fpe(\"Map strings for -M and -G consist of records of the"
4064 " form:\\[rs]n\");\n"
4065 " fpe(\"\\[rs]n\");\n"
4066 " fpe(\" ID-inside-ns ID-outside-ns size\\[rs]n\");\n"
4067 " fpe(\"\\[rs]n\");\n"
4068 " fpe(\"A map string can contain multiple records, separated\"\n"
4069 " \" by commas;\\[rs]n\");\n"
4070 " fpe(\"the commas are replaced by newlines before writing\"\n"
4071 " \" to map files.\\[rs]n\");\n"
4072 "\\&\n"
4073 " exit(EXIT_FAILURE);\n"
4074 "}\n"
4075 "\\&\n"
4076 "/* Update the mapping file \\[aq]map_file\\[aq], with the value provided in\n"
4077 " \\[aq]mapping\\[aq], a string that defines a UID or GID mapping. A UID or\n"
4078 " GID mapping consists of one or more newline-delimited records\n"
4079 " of the form:\n"
4080 "\\&\n"
4081 " ID_inside-ns ID-outside-ns size\n"
4082 "\\&\n"
4083 " Requiring the user to supply a string that contains newlines is\n"
4084 " of course inconvenient for command-line use. Thus, we permit the\n"
4085 " use of commas to delimit records in this string, and replace them\n"
4086 " with newlines before writing the string to the file. */\n"
4087 "\\&\n"
4088 "static void\n"
4089 "update_map(char *mapping, char *map_file)\n"
4090 "{\n"
4091 " int fd;\n"
4092 " size_t map_len; /* Length of \\[aq]mapping\\[aq] */\n"
4093 "\\&\n"
4094 " /* Replace commas in mapping string with newlines. */\n"
4095 "\\&\n"
4096 " map_len = strlen(mapping);\n"
4097 " for (size_t j = 0; j E<lt> map_len; j++)\n"
4098 " if (mapping[j] == \\[aq],\\[aq])\n"
4099 " mapping[j] = \\[aq]\\[rs]n\\[aq];\n"
4100 "\\&\n"
4101 " fd = open(map_file, O_RDWR);\n"
4102 " if (fd == -1) {\n"
4103 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", map_file,\n"
4104 " strerror(errno));\n"
4105 " exit(EXIT_FAILURE);\n"
4106 " }\n"
4107 "\\&\n"
4108 " if (write(fd, mapping, map_len) != map_len) {\n"
4109 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", map_file,\n"
4110 " strerror(errno));\n"
4111 " exit(EXIT_FAILURE);\n"
4112 " }\n"
4113 "\\&\n"
4114 " close(fd);\n"
4115 "}\n"
4116 "\\&\n"
4117 "/* Linux 3.19 made a change in the handling of setgroups(2) and\n"
4118 " the \\[aq]gid_map\\[aq] file to address a security issue. The issue\n"
4119 " allowed *unprivileged* users to employ user namespaces in\n"
4120 " order to drop groups. The upshot of the 3.19 changes is that\n"
4121 " in order to update the \\[aq]gid_maps\\[aq] file, use of the setgroups()\n"
4122 " system call in this user namespace must first be disabled by\n"
4123 " writing \"deny\" to one of the /proc/PID/setgroups files for\n"
4124 " this namespace. That is the purpose of the following function. */\n"
4125 "\\&\n"
4126 "static void\n"
4127 "proc_setgroups_write(pid_t child_pid, char *str)\n"
4128 "{\n"
4129 " char setgroups_path[PATH_MAX];\n"
4130 " int fd;\n"
4131 "\\&\n"
4132 " snprintf(setgroups_path, PATH_MAX, \"/proc/%jd/setgroups\",\n"
4133 " (intmax_t) child_pid);\n"
4134 "\\&\n"
4135 " fd = open(setgroups_path, O_RDWR);\n"
4136 " if (fd == -1) {\n"
4137 "\\&\n"
4138 " /* We may be on a system that doesn\\[aq]t support\n"
4139 " /proc/PID/setgroups. In that case, the file won\\[aq]t exist,\n"
4140 " and the system won\\[aq]t impose the restrictions that Linux 3.19\n"
4141 " added. That\\[aq]s fine: we don\\[aq]t need to do anything in"
4142 " order\n"
4143 " to permit \\[aq]gid_map\\[aq] to be updated.\n"
4144 "\\&\n"
4145 " However, if the error from open() was something other than\n"
4146 " the ENOENT error that is expected for that case, let the\n"
4147 " user know. */\n"
4148 "\\&\n"
4149 " if (errno != ENOENT)\n"
4150 " fprintf(stderr, \"ERROR: open %s: %s\\[rs]n\", setgroups_path,\n"
4151 " strerror(errno));\n"
4152 " return;\n"
4153 " }\n"
4154 "\\&\n"
4155 " if (write(fd, str, strlen(str)) == -1)\n"
4156 " fprintf(stderr, \"ERROR: write %s: %s\\[rs]n\", setgroups_path,\n"
4157 " strerror(errno));\n"
4158 "\\&\n"
4159 " close(fd);\n"
4160 "}\n"
4161 "\\&\n"
4162 "static int /* Start function for cloned child */\n"
4163 "childFunc(void *arg)\n"
4164 "{\n"
4165 " struct child_args *args = arg;\n"
4166 " char ch;\n"
4167 "\\&\n"
4168 " /* Wait until the parent has updated the UID and GID mappings.\n"
4169 " See the comment in main(). We wait for end of file on a\n"
4170 " pipe that will be closed by the parent process once it has\n"
4171 " updated the mappings. */\n"
4172 "\\&\n"
4173 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
4174 " end of the pipe so that we see EOF\n"
4175 " when parent closes its descriptor. */\n"
4176 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
4177 " fprintf(stderr,\n"
4178 " \"Failure in child: read from pipe returned != 0\\[rs]n\");\n"
4179 " exit(EXIT_FAILURE);\n"
4180 " }\n"
4181 "\\&\n"
4182 " close(args-E<gt>pipe_fd[0]);\n"
4183 "\\&\n"
4184 " /* Execute a shell command. */\n"
4185 "\\&\n"
4186 " printf(\"About to exec %s\\[rs]n\", args-E<gt>argv[0]);\n"
4187 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
4188 " err(EXIT_FAILURE, \"execvp\");\n"
4189 "}\n"
4190 "\\&\n"
4191 "#define STACK_SIZE (1024 * 1024)\n"
4192 "\\&\n"
4193 "static char child_stack[STACK_SIZE]; /* Space for child\\[aq]s stack */\n"
4194 "\\&\n"
4195 "int\n"
4196 "main(int argc, char *argv[])\n"
4197 "{\n"
4198 " int flags, opt, map_zero;\n"
4199 " pid_t child_pid;\n"
4200 " struct child_args args;\n"
4201 " char *uid_map, *gid_map;\n"
4202 " const int MAP_BUF_SIZE = 100;\n"
4203 " char map_buf[MAP_BUF_SIZE];\n"
4204 " char map_path[PATH_MAX];\n"
4205 "\\&\n"
4206 " /* Parse command-line options. The initial \\[aq]+\\[aq] character in\n"
4207 " the final getopt() argument prevents GNU-style permutation\n"
4208 " of command-line options. That\\[aq]s useful, since sometimes\n"
4209 " the \\[aq]command\\[aq] to be executed by this program itself\n"
4210 " has command-line options. We don\\[aq]t want getopt() to treat\n"
4211 " those as options to this program. */\n"
4212 "\\&\n"
4213 " flags = 0;\n"
4214 " verbose = 0;\n"
4215 " gid_map = NULL;\n"
4216 " uid_map = NULL;\n"
4217 " map_zero = 0;\n"
4218 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
4219 " switch (opt) {\n"
4220 " case \\[aq]i\\[aq]: flags |= CLONE_NEWIPC; break;\n"
4221 " case \\[aq]m\\[aq]: flags |= CLONE_NEWNS; break;\n"
4222 " case \\[aq]n\\[aq]: flags |= CLONE_NEWNET; break;\n"
4223 " case \\[aq]p\\[aq]: flags |= CLONE_NEWPID; break;\n"
4224 " case \\[aq]u\\[aq]: flags |= CLONE_NEWUTS; break;\n"
4225 " case \\[aq]v\\[aq]: verbose = 1; break;\n"
4226 " case \\[aq]z\\[aq]: map_zero = 1; break;\n"
4227 " case \\[aq]M\\[aq]: uid_map = optarg; break;\n"
4228 " case \\[aq]G\\[aq]: gid_map = optarg; break;\n"
4229 " case \\[aq]U\\[aq]: flags |= CLONE_NEWUSER; break;\n"
4230 " default: usage(argv[0]);\n"
4231 " }\n"
4232 " }\n"
4233 "\\&\n"
4234 " /* -M or -G without -U is nonsensical */\n"
4235 "\\&\n"
4236 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
4237 " !(flags & CLONE_NEWUSER)) ||\n"
4238 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
4239 " usage(argv[0]);\n"
4240 "\\&\n"
4241 " args.argv = &argv[optind];\n"
4242 "\\&\n"
4243 " /* We use a pipe to synchronize the parent and child, in order to\n"
4244 " ensure that the parent sets the UID and GID maps before the child\n"
4245 " calls execve(). This ensures that the child maintains its\n"
4246 " capabilities during the execve() in the common case where we\n"
4247 " want to map the child\\[aq]s effective user ID to 0 in the new user\n"
4248 " namespace. Without this synchronization, the child would lose\n"
4249 " its capabilities if it performed an execve() with nonzero\n"
4250 " user IDs (see the capabilities(7) man page for details of the\n"
4251 " transformation of a process\\[aq]s capabilities during execve()). */\n"
4252 "\\&\n"
4253 " if (pipe(args.pipe_fd) == -1)\n"
4254 " err(EXIT_FAILURE, \"pipe\");\n"
4255 "\\&\n"
4256 " /* Create the child in new namespace(s). */\n"
4257 "\\&\n"
4258 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
4259 " flags | SIGCHLD, &args);\n"
4260 " if (child_pid == -1)\n"
4261 " err(EXIT_FAILURE, \"clone\");\n"
4262 "\\&\n"
4263 " /* Parent falls through to here. */\n"
4264 "\\&\n"
4265 " if (verbose)\n"
4266 " printf(\"%s: PID of child created by clone() is %jd\\[rs]n\",\n"
4267 " argv[0], (intmax_t) child_pid);\n"
4268 "\\&\n"
4269 " /* Update the UID and GID maps in the child. */\n"
4270 "\\&\n"
4271 " if (uid_map != NULL || map_zero) {\n"
4272 " snprintf(map_path, PATH_MAX, \"/proc/%jd/uid_map\",\n"
4273 " (intmax_t) child_pid);\n"
4274 " if (map_zero) {\n"
4275 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %jd 1\",\n"
4276 " (intmax_t) getuid());\n"
4277 " uid_map = map_buf;\n"
4278 " }\n"
4279 " update_map(uid_map, map_path);\n"
4280 " }\n"
4281 "\\&\n"
4282 " if (gid_map != NULL || map_zero) {\n"
4283 " proc_setgroups_write(child_pid, \"deny\");\n"
4284 "\\&\n"
4285 " snprintf(map_path, PATH_MAX, \"/proc/%jd/gid_map\",\n"
4286 " (intmax_t) child_pid);\n"
4287 " if (map_zero) {\n"
4288 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\",\n"
4289 " (intmax_t) getgid());\n"
4290 " gid_map = map_buf;\n"
4291 " }\n"
4292 " update_map(gid_map, map_path);\n"
4293 " }\n"
4294 "\\&\n"
4295 " /* Close the write end of the pipe, to signal to the child that we\n"
4296 " have updated the UID and GID maps. */\n"
4297 "\\&\n"
4298 " close(args.pipe_fd[1]);\n"
4299 "\\&\n"
4300 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
4301 " err(EXIT_FAILURE, \"waitpid\");\n"
4302 "\\&\n"
4303 " if (verbose)\n"
4304 " printf(\"%s: terminating\\[rs]n\", argv[0]);\n"
4305 "\\&\n"
4306 " exit(EXIT_SUCCESS);\n"
4307 "}\n"
4308
4309 #. type: TH
4310 #: mageia-cauldron
4311 #, no-wrap
4312 msgid "Linux man-pages 6.17"
4313 msgstr "صفحات دليل لينكس 6.17"
4314
4315 #. type: TH
4316 #: opensuse-leap-16-1 opensuse-tumbleweed
4317 #, no-wrap
4318 msgid "Linux man-pages (unreleased)"
4319 msgstr "صفحات دليل لينكس (لم تصدر بعد)"
4320