You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/02/16 10:25:20 UTC

[incubator-datalab] branch DATALAB-2091 updated: [DATALAB-2091]: changed how sudoers file is changed

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-2091
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2091 by this push:
     new dfaa48a  [DATALAB-2091]: changed how sudoers file is changed
dfaa48a is described below

commit dfaa48a78b491b4132ac50ff7b58342a144be5a4
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Feb 16 12:25:00 2021 +0200

    [DATALAB-2091]: changed how sudoers file is changed
---
 infrastructure-provisioning/src/base/scripts/create_ssh_user.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/infrastructure-provisioning/src/base/scripts/create_ssh_user.py b/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
index a2cf44f..0832155 100644
--- a/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
+++ b/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
@@ -43,7 +43,7 @@ def ensure_ssh_user(initial_user, os_user, sudo_group, conn):
     if not exists(conn, '/home/{}/.ssh_user_ensured'.format(initial_user)):
         conn.sudo('hostname; pwd; whoami; ls -lah /etc/sudoers')
         conn.sudo('useradd -m -G {1} -s /bin/bash {0}'.format(os_user, sudo_group))
-        conn.sudo('echo "{} ALL = NOPASSWD:ALL" >> /etc/sudoers'.format(os_user))
+        conn.sudo('bash -c "echo \'{} ALL = NOPASSWD:ALL\' >> /etc/sudoers"'.format(os_user))
         conn.sudo('mkdir /home/{}/.ssh'.format(os_user))
         conn.sudo('chown -R {0}:{0} /home/{1}/.ssh/'.format(initial_user, os_user))
         conn.sudo('cat /home/{0}/.ssh/authorized_keys > /home/{1}/.ssh/authorized_keys'.format(initial_user, os_user))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org