Skip to content

Commit

Permalink
Check for non-interactive sudo using -n -l (#221)
Browse files Browse the repository at this point in the history
- previous sudo validation using `sudo -n true` is not really needed
  when there is a `sudo -l` option that will validate that sudo is on
  the system

PRODENG-2503 sudo cleanup in launchpad
Signed-off-by: James Nesbitt <[email protected]>
  • Loading branch information
james-nesbitt authored Aug 27, 2024
1 parent 7c41ec9 commit 567e12c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (c *Connection) configureSudo() {
c.sudofunc = sudoNoop
return
}
if c.Exec(`sudo -n true`) == nil {
if c.Exec(`sudo -n -l`) == nil {
// user has passwordless sudo
c.sudofunc = sudoSudo
return
Expand Down

0 comments on commit 567e12c

Please sign in to comment.