From 1b4783ea1c6bd65bfbd81cda5e315046ae354bba Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 17 May 2022 12:32:50 +0200 Subject: [PATCH] mgr/cephadm: do not use sudo for root user Fixes: https://tracker.ceph.com/issues/55641 Signed-off-by: Redouane Kachach (cherry picked from commit 7cfcc7ef089cb3458040b9b592a7d0bafbf4c2c2) --- src/pybind/mgr/cephadm/ssh.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/ssh.py b/src/pybind/mgr/cephadm/ssh.py index fb2d001fc2ae7..e874ba6d78fe8 100644 --- a/src/pybind/mgr/cephadm/ssh.py +++ b/src/pybind/mgr/cephadm/ssh.py @@ -136,7 +136,8 @@ class SSHManager: addr: Optional[str] = None, ) -> Tuple[str, str, int]: conn = await self._remote_connection(host, addr) - cmd = "sudo " + " ".join(quote(x) for x in cmd) + sudo_prefix = "sudo " if self.mgr.ssh_user != 'root' else "" + cmd = sudo_prefix + " ".join(quote(x) for x in cmd) logger.debug(f'Running command: {cmd}') try: r = await conn.run('sudo true', check=True, timeout=5) -- 2.39.5