diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-27 15:42:01 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-27 15:42:01 -0700 |
commit | 0c47cf7807a064b854d59488007d904089dccbd7 (patch) | |
tree | 679fcbbc3f210bd532f642e84ba923d528634cb9 /src/connection/as.lisp | |
parent | cfe16b763ba7f643861fef76ad1ed5642c5de264 (diff) | |
download | consfigurator-0c47cf7807a064b854d59488007d904089dccbd7.tar.gz |
:AS connection type uses :SU not :SUDO
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection/as.lisp')
-rw-r--r-- | src/connection/as.lisp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/connection/as.lisp b/src/connection/as.lisp index b5a9f69..6f6edc6 100644 --- a/src/connection/as.lisp +++ b/src/connection/as.lisp @@ -24,13 +24,14 @@ (zerop (foreign-funcall "geteuid" :int))) (defmethod establish-connection ((type (eql :as)) remaining &key to) - "Establish a :SETUID or :SUDO connection to another user account, depending -on whether it is possible to establish a :SETUID connection. - -This connection type does not support sudo with a password -- it is designed -to be used as root." - (if (and (lisp-connection-p) - (can-setuid) - (can-probably-fork)) - (establish-connection :setuid remaining :to to) - (establish-connection :sudo remaining :user to))) + "Establish a :SETUID or :SU connection to another user account, depending on +whether it is possible to establish a :SETUID connection. + +Note that both these connection types require root." + ;; An alternative to :SU would be :SUDO or runuser(1), but :SU is more + ;; portable. + (establish-connection (if (and (lisp-connection-p) + (can-setuid) + (can-probably-fork)) + :setuid :su) + remaining :to to)) |