bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[web:add translator pages 05/15] add translator/fakeroot page


From: address@hidden
Subject: [web:add translator pages 05/15] add translator/fakeroot page
Date: Wed, 16 Oct 2024 19:30:21 -0400

* hurd/translator.mdwn: add a link to fakeroot
* hurd/translator/fakeroot.mdwn: I added a trivial example.
---
 hurd/translator.mdwn          |  1 +
 hurd/translator/fakeroot.mdwn | 65 +++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 hurd/translator/fakeroot.mdwn

diff --git a/hurd/translator.mdwn b/hurd/translator.mdwn
index 1a8f8adf..3ed8b233 100644
--- a/hurd/translator.mdwn
+++ b/hurd/translator.mdwn
@@ -107,6 +107,7 @@ The [[concept|concepts]] of translators creates its own 
problems, too:
 * [[unionfs]]
 * [[nfs]]
 * [[symlink]]
+* [[fakeroot]]
 * [[firmlink]]
 * [[fifo]]
 * [[term]]
diff --git a/hurd/translator/fakeroot.mdwn b/hurd/translator/fakeroot.mdwn
new file mode 100644
index 00000000..b8ea7183
--- /dev/null
+++ b/hurd/translator/fakeroot.mdwn
@@ -0,0 +1,65 @@
+[[!meta copyright="Copyright © 2024 Free Software Foundation,
+Inc."]]
+
+[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
+id="license" text="Permission is granted to copy, distribute and/or modify this
+document under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no Invariant
+Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
+is included in the section entitled [[GNU Free Documentation
+License|/fdl]]."]]"""]]
+
+[[!tag stable_URL]]
+
+A translator for faking privileged access to an underlying filesystem.
+
+This translator appears to give transparent access to the underlying
+directory node.  However, all accesses are made using the credentials
+of the translator regardless of the client and the translator fakes
+success for chown and chmod operations that only root could actually
+do, reporting the faked IDs and modes in later stat calls, and allows
+any user to open nodes regardless of permissions as is done for root.
+
+## A trivial example
+
+Let's demonstrate that chown and chgrp requires root permission.
+
+    $ mkdir ~/etc/
+    $ touch ~/etc/this
+    $ settrans ~/etc/this /hurd/hello
+    $ ls -lha ~/etc/
+      total 12K
+         drwxr-xr-x  2 joshua joshua 4.0K Oct 15 20:12 .
+         drwxr-xr-x 33 joshua joshua 4.0K Oct 15 20:11 ..
+         -r--r--r--  1 joshua joshua   14 Oct 15 20:12 this
+       $
+    $ chown root ~/etc/this 2>&1
+         chown: changing ownership of '/home/joshua/etc/this': Operation not 
permitted
+
+Now, let's attach `/hurd/fakeroot` to `~/etc`, and we'll be able to
+use `chown`, `chgrp`, and `chmod` as a normal user.
+
+    $ settrans ~/etc /hurd/fakeroot
+    $ cd ~/etc
+    $ cd
+    $ showtrans ~/etc
+         /hurd/fakeroot
+    $ ls -lha ~/etc/
+
+         total 16K
+      drwxr-xr-x  2 joshua joshua 4.0K Oct 15 20:12 .
+      drwxr-xr-x 33 root   root   4.0K Oct 15 20:11 ..
+         -r--r--r--  1 root   root     14 Oct 15 20:12 this
+
+`fakeroot` turns all the owner and group to root when it starts.  Now
+we can chmod, chown, and chgrp as a normal user.
+
+    $ chown joshua ~/etc/this
+    $ chgrp joshua ~/etc/this
+    $ chmod +xr ~/etc/this
+    $ ls -lha ~/etc/
+         total 16K
+      drwxr-xr-x  2 joshua joshua 4.0K Oct 15 20:12 .
+      drwxr-xr-x 33 root   root   4.0K Oct 15 20:11 ..
+      -rwxr-xr-x  1 joshua joshua   14 Oct 15 20:12 this
+
-- 
2.45.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]