From 4fdb48ef349c0b8dda6bffa171de622ebb9d320e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Thu, 21 Mar 2019 11:10:28 +0100 Subject: [PATCH] Check for root privileges by inspecting the effective UID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The effective UID is what matters when it comes to the ability to perform privileged actions, not the real UID. Signed-off-by: Ondřej Lysoněk --- tuned/utils/profile_recommender.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuned/utils/profile_recommender.py b/tuned/utils/profile_recommender.py index 194f032..cae75eb 100644 --- a/tuned/utils/profile_recommender.py +++ b/tuned/utils/profile_recommender.py @@ -7,7 +7,7 @@ from configobj import ConfigObj, ConfigObjError have_dmidecode = False try: - if (os.getuid() == 0 and platform.machine() in ["i386", "i486", "i586", "i686", "x86_64"]): + if (os.geteuid() == 0 and platform.machine() in ["i386", "i486", "i586", "i686", "x86_64"]): import dmidecode have_dmidecode = True except: