Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: documentation of PRIVILEGED
- X-seq: zsh-workers 33643
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: documentation of PRIVILEGED
- Date: Sat, 08 Nov 2014 12:59:02 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1415447944; bh=95zXI6kCM3rfNe/+6bNfHxmwZ6zlUGPBh3p+BCJLhn4=; h=From:To:Subject:Date:From:Subject; b=VG6BUF6AIdOn+Bw4HpVfDrPJsFTSACr6c+GI8G675F3E8YYesW+LMBiPUoJURwaCrPWHps9XFLvCrFHvmE4AONSMBw69KNhsDRjvyMwiOsOzPpMoNnvpiZZP9aoi2MD2hLmew9xX0C6g4zxOC7jmBU9chkGgqqymWRsQkd9SSh5XfbohlLixzdKu+TPV88HRJveRW/bqnqZRgUTEQabdHbon3KDX2s+cJOi03wG4xvidVKcHpUryb+o0ZIeQC1Y4SolbK7vUjyqOnJv4JDYjDZuDcGbT/ffFpwu89UsJssAd0oBt74vg6KXAzZfgDNClvDaD+1fOZ9idam9/10AUiA==
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=ZEw8cdjaxkZfN759Ht28JMi86RzpZmlP0JV1c85r2AAf3t3rOpZMyJd9CBVkuKBp1wmPJPJ83Jc1sCRTBCAXES0nhzRWotN/9XGPAKOEHotXFNMDJL7+64A5e770uhWQ7QZ8KJHFfmqJqyLiOAmpBm2D6PgUMtj3MJS/ONlUqaD0d74Lv15+T4ymu+A1EG9S/zFNxbObsHDV5d4SFkq5MXBLC+MlNzQcu95Ja+2qUPE+3NSu8bEUktm9Oz/bhIF0fWMRwbEjDgcc6I4h9N4ma6xZjQlJWUc5JY58CYeYVoQlKS09UJ7yGvyU1kgDlMcLvs8j6QIrDg6yKsMbt6MvsQ==;
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
On a modern system where setuid scripts are disabled, the PRIVILEGED
option is perhaps more relevant to someone using sudo as a wrapper or
something else such as ssh force command or dbus activation. In these
cases, zsh doesn't enable PRIVILEGED for them automatically: it has to be
done manually. This makes that more explicit and also suggests checking
the return status when unsetting the option.
Oliver
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 452b258..b9f78bf 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2195,10 +2195,22 @@ pindex(NOPRIVILEGED)
cindex(privileged mode)
cindex(mode, privileged)
item(tt(PRIVILEGED) (tt(-p), ksh: tt(-p)))(
-Turn on privileged mode. This is enabled automatically on startup if the
-effective user (group) ID is not equal to the real user (group) ID. Turning
-this option off causes the effective user and group IDs to be set to the
-real user and group IDs. This option disables sourcing user startup files.
+Turn on privileged mode. Typically this is used when script is to be run
+with elevated privileges. This should be done as follows directly with
+the tt(-p) option to zsh so that it takes effect during startup.
+
+example(#!/bin/zsh -p)
+
+The option is enabled automatically on startup if the effective user
+(group) ID is not equal to the real user (group) ID. In this case,
+turning the option off causes the effective user and group IDs to be set
+to the real user and group IDs. Be aware that if that fails the shell may
+be running with different IDs than was intended so a script should check
+for failure and act accordingly, for example:
+
+example(unsetopt privileged || exit)
+
+The tt(PRIVILEGED) option disables sourcing user startup files.
If zsh is invoked as `tt(sh)' or `tt(ksh)' with this option set,
tt(/etc/suid_profile) is sourced (after tt(/etc/profile) on interactive
shells). Sourcing tt(~/.profile) is disabled and the contents of the
Messages sorted by:
Reverse Date,
Date,
Thread,
Author