Skip to content

Commit

Permalink
Merge pull request #298 from knqyf263/check_echo
Browse files Browse the repository at this point in the history
Check whether echo is executable with nopasswd
  • Loading branch information
kotakanbe authored Jan 23, 2017
2 parents 8fe34c8 + f62d869 commit d60a411
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scan/redhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d60a411

Please sign in to comment.