X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-keys/blobdiff_plain/d516ebd0d3928deae4cf80a113d6ccf1f666bfe6..4c8c406559cd6b201004955a3db7cb3386a0f00d:/keyfunc.sh.in diff --git a/keyfunc.sh.in b/keyfunc.sh.in index b55bd99..6316816 100644 --- a/keyfunc.sh.in +++ b/keyfunc.sh.in @@ -129,6 +129,17 @@ parse_keylabel () { knub=$KEYS/nub/$kowner/$klabel } +runas () { + user=$1 service=$2; shift 2 + ## If the current (effective) user is not USER then reinvoke via `userv', + ## as the specified service, with the remaining arguments. + + case $(id -un) in + "$user") ;; + *) exec userv "$user" "$service" "$@" ;; + esac +} + ###-------------------------------------------------------------------------- ### Input validation functions.