Skip to content

Commit

Permalink
Automatic Man Page Update
Browse files Browse the repository at this point in the history
Signed-off-by: distrobox-docs-bot <[email protected]>
  • Loading branch information
actions-user authored and distrobox-docs-bot committed Feb 26, 2024
1 parent d447d8c commit b24e026
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 138 deletions.
69 changes: 0 additions & 69 deletions man/man1/distrobox-export.1
Original file line number Diff line number Diff line change
Expand Up @@ -135,75 +135,6 @@ distrobox-export --bin /usr/bin/vim --export-path \[ti]/.local/bin --delete
The option \[lq]\[en]sudo\[rq] will launch the exported item as root
inside the distrobox.
.PP
\f[B]Exporting apps from rootful containers\f[R]
.PP
It is worth noting that, when exporting any item - which includes
graphical apps - from rootful containers (created with
\f[V]distrobox create --root\f[R]), root privileges will be needed every
time the item is launched (in order to enter the rootful container),
which, by default, is done using \f[V]sudo\f[R] (see docs for
\f[V]distrobox-enter\f[R] on how to customize that).
However, for graphical apps in specific, since they launch without a
terminal, the usage of \f[V]sudo\f[R] might, at first, make it
impossible to launch them.
.PP
To fix this without needing to customize the sudo program, one can
define a global \f[V]SUDO_ASKPASS\f[R] environment variable on their
machine, which is a PATH to an executable that is run by \f[V]sudo\f[R]
when no terminal is available (or when it is given the
\f[V]--askpass\f[R] or \f[V]-A\f[R] option), and the output of that
executable to stdout is used as the password input.
The executable is called as many times is needed for authentication as
root to succeed (unless a limit of amount of attempts is reached).
.PP
To do this, pick a program to ask the user for graphical password input.
In this example, we will use \f[V]zenity --password\f[R], which should
be present for GNOME users (and can also be installed in other DEs) -
there are other options, such as
\f[V]kdialog --password \[dq]Message\[dq]\f[R] for KDE users.
.PP
Write the call to the desired program to a script file, for example to
\f[V]/usr/bin/my-password-prompt\f[R] (sample contents below):
.IP
.nf
\f[C]
#!/bin/sh
zenity --password \[dq]Authentication as root is required\[dq]
\f[R]
.fi
.PP
(You may save the script under, for example, \f[V]\[ti]/.local/bin\f[R]
if you want to keep it fully local to your user.)
.PP
Afterwards, make it executable (e.g.\ run
\f[V]sudo chmod +x /usr/bin/my-password-prompt\f[R]).
Then, make sure to set \f[V]SUDO_ASKPASS\f[R] to
\f[V]\[dq]/usr/bin/my-password-prompt\[dq]\f[R] (replace with your
script\[cq]s path) in a global profile file, so that it is picked up by
sudo when running graphical apps (and, therefore, sudo will run the
script you created to ask for a password).
This is done with the shell line
\f[V]export SUDO_ASKPASS=\[dq]/path/to/script/goes/here\[dq]\f[R].
You can do this for your user only by running the command below (replace
the script path as needed):
.IP
.nf
\f[C]
echo \[aq]export SUDO_ASKPASS=\[dq]/usr/bin/my-password-prompt\[dq]\[aq] >> \[ti]/.profile
\f[R]
.fi
.PP
Which appends the appropriate line to the end of your
\f[V]\[ti]/.profile\f[R] file, thus making the change local to your
user.
Alternatively, to set it system-wide (for all users), you may create a
file in \f[V]/etc/profile.d/\f[R] (or equivalent for your system) with
that line.
.PP
Now just log out and log back in, and graphical apps exported from
rootful containers should now be properly asking for root\[cq]s password
before launching (instead of not opening, if that was the case before).
.PP
\f[B]Notes\f[R]
.PP
Note you can use \[en]app OR \[en]bin but not together.
Expand Down
69 changes: 0 additions & 69 deletions man/man1/distrobox.1
Original file line number Diff line number Diff line change
Expand Up @@ -1529,75 +1529,6 @@ distrobox-export --bin /usr/bin/vim --export-path \[ti]/.local/bin --delete
The option \[lq]\[en]sudo\[rq] will launch the exported item as root
inside the distrobox.
.PP
\f[B]Exporting apps from rootful containers\f[R]
.PP
It is worth noting that, when exporting any item - which includes
graphical apps - from rootful containers (created with
\f[V]distrobox create --root\f[R]), root privileges will be needed every
time the item is launched (in order to enter the rootful container),
which, by default, is done using \f[V]sudo\f[R] (see docs for
\f[V]distrobox-enter\f[R] on how to customize that).
However, for graphical apps in specific, since they launch without a
terminal, the usage of \f[V]sudo\f[R] might, at first, make it
impossible to launch them.
.PP
To fix this without needing to customize the sudo program, one can
define a global \f[V]SUDO_ASKPASS\f[R] environment variable on their
machine, which is a PATH to an executable that is run by \f[V]sudo\f[R]
when no terminal is available (or when it is given the
\f[V]--askpass\f[R] or \f[V]-A\f[R] option), and the output of that
executable to stdout is used as the password input.
The executable is called as many times is needed for authentication as
root to succeed (unless a limit of amount of attempts is reached).
.PP
To do this, pick a program to ask the user for graphical password input.
In this example, we will use \f[V]zenity --password\f[R], which should
be present for GNOME users (and can also be installed in other DEs) -
there are other options, such as
\f[V]kdialog --password \[dq]Message\[dq]\f[R] for KDE users.
.PP
Write the call to the desired program to a script file, for example to
\f[V]/usr/bin/my-password-prompt\f[R] (sample contents below):
.IP
.nf
\f[C]
#!/bin/sh
zenity --password \[dq]Authentication as root is required\[dq]
\f[R]
.fi
.PP
(You may save the script under, for example, \f[V]\[ti]/.local/bin\f[R]
if you want to keep it fully local to your user.)
.PP
Afterwards, make it executable (e.g.\ run
\f[V]sudo chmod +x /usr/bin/my-password-prompt\f[R]).
Then, make sure to set \f[V]SUDO_ASKPASS\f[R] to
\f[V]\[dq]/usr/bin/my-password-prompt\[dq]\f[R] (replace with your
script\[cq]s path) in a global profile file, so that it is picked up by
sudo when running graphical apps (and, therefore, sudo will run the
script you created to ask for a password).
This is done with the shell line
\f[V]export SUDO_ASKPASS=\[dq]/path/to/script/goes/here\[dq]\f[R].
You can do this for your user only by running the command below (replace
the script path as needed):
.IP
.nf
\f[C]
echo \[aq]export SUDO_ASKPASS=\[dq]/usr/bin/my-password-prompt\[dq]\[aq] >> \[ti]/.profile
\f[R]
.fi
.PP
Which appends the appropriate line to the end of your
\f[V]\[ti]/.profile\f[R] file, thus making the change local to your
user.
Alternatively, to set it system-wide (for all users), you may create a
file in \f[V]/etc/profile.d/\f[R] (or equivalent for your system) with
that line.
.PP
Now just log out and log back in, and graphical apps exported from
rootful containers should now be properly asking for root\[cq]s password
before launching (instead of not opening, if that was the case before).
.PP
\f[B]Notes\f[R]
.PP
Note you can use \[en]app OR \[en]bin but not together.
Expand Down

0 comments on commit b24e026

Please sign in to comment.