diff --git a/scan/redhat.go b/scan/redhat.go index 1f228f75..97784850 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -97,7 +97,11 @@ func detectRedhat(c config.ServerInfo) (itsMe bool, red osTypeInterface) { } func (o *redhat) checkIfSudoNoPasswd() error { - r := o.exec("yum --version", o.sudo()) + cmd := "yum --version" + if o.Distro.Family == "centos" { + cmd = "echo N | " + cmd + } + r := o.exec(cmd, o.sudo()) if !r.isSuccess() { o.log.Errorf("sudo error on %s", r) return fmt.Errorf("Failed to sudo: %s", r)