Skip to content

Commit

Permalink
Dev: run-functional-tests: Change /etc/sudoers as /usr/etc/sudoers
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Feb 19, 2024
1 parent 0eaa99d commit 856c22c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/run-functional-tests
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ HA_NETWORK_V6_ARRAY[0]="2001:db8:10::/64"
HA_NETWORK_V6_ARRAY[1]="2001:db8:20::/64"
BEHAVE_CASE_DIR="$(dirname $0)/features/"
BEHAVE_CASE_EXCLUDE="sbd|ocfs2"
SUDOERS="/usr/etc/sudoers"

read -r -d '' SSHD_CONFIG_AZURE << EOM
PermitRootLogin no
Expand Down Expand Up @@ -187,9 +188,9 @@ create_custom_user() {
user_name=$1
user_id=$2
docker_exec $node_name "useradd -m -s /bin/bash ${user_name} 2>/dev/null"
docker_exec $node_name "chmod u+w /etc/sudoers"
docker_exec $node_name "echo \"${user_name} ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
docker_exec $node_name "chmod u-w /etc/sudoers"
docker_exec $node_name "chmod u+w ${SUDOERS}"
docker_exec $node_name "echo \"${user_name} ALL=(ALL) NOPASSWD: ALL\" >> ${SUDOERS}"
docker_exec $node_name "chmod u-w ${SUDOERS}"
docker_exec $node_name "echo 'export PATH=\$PATH:/usr/sbin/' >> ~${user_name}/.bashrc"
docker_exec $node_name "echo -e \"linux\\nlinux\" | passwd ${user_name} 2>/dev/null"
docker_exec $node_name "cp -r /root/.ssh ~${user_name}/ && chown ${user_name}:haclient -R ~${user_name}/.ssh"
Expand Down

0 comments on commit 856c22c

Please sign in to comment.