diff --git a/scan/redhat.go b/scan/redhat.go index d10d3272c4..23e23b91cc 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -576,10 +576,7 @@ func (o *redhat) getAllChangelog(packInfoList models.PackageInfoList) (stdout st packageNames += fmt.Sprintf("%s ", packInfo.Name) } - command := "" - if o.ServerInfo.User == "root" { - command = "echo N | " - } + command := "echo N | " if 0 < len(config.Conf.HTTPProxy) { command += util.ProxyEnv() } diff --git a/scan/sshutil.go b/scan/sshutil.go index 1042a79aa2..7c38ec5764 100644 --- a/scan/sshutil.go +++ b/scan/sshutil.go @@ -299,6 +299,7 @@ func getSSHLogger(log ...*logrus.Entry) *logrus.Entry { func decolateCmd(c conf.ServerInfo, cmd string, sudo bool) string { if sudo && c.User != "root" && !c.IsContainer() { cmd = fmt.Sprintf("sudo -S %s", cmd) + cmd = strings.Replace(cmd, "|", "| sudo ", -1) } if c.Family != "FreeBSD" {