Skip to content

Commit 5c6a955

Browse files
committed
resolve sudoadmin edge case issue with revision-control app
1 parent 4ed432f commit 5c6a955

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

turnkey-sudoadmin

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ setup_initfence() {
108108

109109
update_confconsole_services() {
110110
info $FUNCNAME $@
111-
username=$1
111+
new_uname=$1
112+
old_uname=$2
112113
cfg="/etc/confconsole/services.txt"
113114
[ -e $cfg ] || return 0
114-
sed -i "s|\S*@|${username}@|g" $cfg
115+
sed -i "s|${old_uname}@|${new_uname}@|g" $cfg
115116
}
116117

117118
ssh_authorizedkeys_inithook() {
@@ -222,7 +223,7 @@ case $1 in
222223
passwordless_sudo "admin";
223224
inithooks_sudoadmin "true";
224225
setup_initfence "admin";
225-
update_confconsole_services "admin";
226+
update_confconsole_services "admin" "root";
226227
ssh_authorizedkeys_inithook "admin";
227228
ssh_authorizedkeys_merge "admin" "root";
228229
user_state "admin" "unlock";
@@ -238,7 +239,7 @@ case $1 in
238239
[ "$(id -u)" != "0" ] && fatal "must be run with root permissions"
239240
inithooks_sudoadmin "false";
240241
setup_initfence "root";
241-
update_confconsole_services "root";
242+
update_confconsole_services "root" "admin";
242243
ssh_authorizedkeys_inithook "root";
243244
ssh_authorizedkeys_merge "root" "admin";
244245
permitrootlogin_ssh "yes";

0 commit comments

Comments
 (0)