From 5e957f6350ebd3bd3782e625ac67dd9db0e8b834 Mon Sep 17 00:00:00 2001 From: Gabriele Cerami Date: Wed, 3 Aug 2016 15:03:14 +0200 Subject: [PATCH] secure_path in sudoers: deal with possible quotes Sometimes the secure_path option value in /etc/sudoers is surrounded by quotes, in this case the current command creates an invalid entry and it's not possible to sudo anymore. This fix adjust the sed command to deal with possible quotes Change-Id: Ifd6f9e29b3c0d04d6f65d3f55524ad202fb3294e --- elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path b/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path index 8d70bfce..664db11d 100755 --- a/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path +++ b/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path @@ -6,5 +6,5 @@ fi set -eu set -o pipefail -sed -i '/secure_path/ s/$/:\/usr\/local\/bin/' /etc/sudoers +sed -i -e "/secure_path/ s@\([\'\"]\?\)\$@:/usr/local/bin/\1@" /etc/sudoers visudo -c