question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

runsas broken on Fedora29

See original GitHub issue

The runas option isn’t effective on Fedora 29 with salt-2018.3.2-5.fc29.noarch because getpass.getuser() while running as root is returning the runas username. This affects cmd.run, git.latest, etc. I am running salt from an interactive shell as user me with sudo salt-call ... exclusively, so it might be specific to that use case.

I’ve fixed it for myself with this patch:

--- utils/user.py.orig  2018-06-27 11:04:57.000000000 -0500
+++ utils/user.py       2019-01-04 07:45:21.322476941 -0600
@@ -222,7 +222,9 @@
     Helper method for for subprocess.Popen to initialise uid/gid and umask
     for the new process.
     '''
-    if runas is not None and runas != getpass.getuser():
+#   if runas is not None and runas != getpass.getuser():
+    uinfo = pwd.getpwnam(runas)
+    if os.getuid() != uinfo.pw_uid:
         chugid(runas)
     if umask is not None:
         os.umask(umask)  # pylint: disable=blacklisted-function

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mariushochcommented, Apr 2, 2021

Still a problem on Fedora 33, probably for the same reason (both ran as root):

LOGNAME=root python3 -c 'import getpass; print(getpass.getuser())'
root
LOGNAME=marius python3 -c 'import getpass; print(getpass.getuser())'
marius

Worked around by using alias salt-call='LOGNAME=root salt-call'.

1reaction
Ch3LLcommented, Jan 17, 2019

thanks for pointing that out @cdalvaro @c-wicklein does that look like a duplicate of your issue? If so i’ll close here and we can monitor in the other issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common F29 bugs - Fedora Project Wiki
This page documents common bugs in Fedora 29 and, if available, fixes or workarounds for these problems. If you find your problem in...
Read more >
Fedoraproject Fedora version 29 : Security vulnerabilities
# CVE ID CWE ID Vulnerability Type(s) Publish Date Update Date Score Gai... 1 CVE‑2019‑1010319 908 2019‑07‑11 2021‑02‑09 4.3 None 2 CVE‑2019‑1010317 908 2019‑07‑11 2022‑10‑06...
Read more >
Upgrading Fedora 29 to Fedora 30
1. Update software and back up your system. Before you do anything, you will want to make sure you have the latest software...
Read more >
Printer stopped working after installation of Fedora 29
Apparently it's only the Fedora printer UI that's broken, not the underlying printer services. So until this bug is fixed, ...
Read more >
How to Fix Display Issues in Fedora - YouTube
This video goes over fixing display issues with moving multi-monitors in display settings. It also fixes a black screen I was getting when ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found