Skip to content

Commit dba8f5f

Browse files
authored
Fixed last 3 commands with hardcode admin user (hestiacp#3928)
* Fixed last 3 commands with hardcode admin user * Some more
1 parent 1a316bc commit dba8f5f

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

bin/v-acknowledge-user-notification

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ check_hestia_demo_mode
4343

4444
# Updating notification
4545
if [ "$id" = 'all' ]; then
46-
for id in $(v-list-user-notifications admin plain | cut -f1); do
46+
for id in $(v-list-user-notifications "$user" plain | cut -f1); do
4747
update_object_value 'notifications' 'NID' "$id" '$ACK' 'yes' 2> /dev/null
4848
done
4949
else

bin/v-add-remote-dns-host

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,15 @@ check_result $? "$HOST sync failed" "$E_CONNECT"
119119
#----------------------------------------------------------#
120120

121121
# Adding local dns-cluster cron job
122-
cmd="sudo $BIN/v-update-sys-queue dns-cluster"
123-
check_cron=$(grep "$cmd" $HESTIA/data/users/admin/cron.conf 2> /dev/null)
122+
cmd="v-update-sys-queue dns-cluster"
123+
check_cron=$(grep "$cmd" "/var/spool/cron/crontabs/hestiaweb" 2> /dev/null)
124124
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
125-
$BIN/v-add-cron-job admin '*/5' '*' '*' '*' '*' "$cmd"
125+
min='*/5'
126+
hour='0'
127+
day='*'
128+
month='*'
129+
wday='*'
130+
echo "$min $hour * * * sudo /usr/local/hestia/bin/$cmd" > "/var/spool/cron/crontabs/hestiaweb"
126131
fi
127132

128133
# Logging

bin/v-add-user-sftp-key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fi
7070

7171
#
7272
chown ${user}: "${AUTHKEY_FILE}"
73-
chown admin: "${PRVKEY_FILE}"
73+
chown ${ROOT_USER} : "${PRVKEY_FILE}"
7474

7575
#----------------------------------------------------------#
7676
# Hestia #

bin/v-delete-user

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ source_conf "$HESTIA/conf/hestia.conf"
3636
check_args '1' "$#" 'USER [RESTART]'
3737
is_format_valid 'user'
3838
is_object_valid 'user' 'USER' "$user"
39-
if [ "$user" = 'admin' ]; then
39+
if [ "$user" = "$ROOT_USER" ]; then
4040
exit
4141
fi
4242

@@ -110,8 +110,8 @@ rm -f /var/spool/cron/crontabs/$user
110110
rm -rf $USER_DATA
111111

112112
# Updating admin counter
113-
if [ "$user" != 'admin' ]; then
114-
decrease_user_value 'admin' '$U_USERS'
113+
if [ "$user" != "$ROOT_USER" ]; then
114+
decrease_user_value "$ROOT_USER" '$U_USERS'
115115
fi
116116

117117
#----------------------------------------------------------#

bin/v-delete-user-ips

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ source_conf "$HESTIA/conf/hestia.conf"
3030
check_args '1' "$#" 'USER'
3131
is_format_valid 'user'
3232
is_object_valid 'user' 'USER' "$user"
33-
if [ "$user" = 'admin' ]; then
33+
if [ "$user" = "$ROOT_USER" ]; then
3434
exit
3535
fi
3636

bin/v-list-users-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ check_args '0' "$#" '[FORMAT]'
127127
$BIN/v-update-user-stats
128128

129129
# Defining config
130-
conf="$HESTIA/data/users/admin/overall_stats.log"
130+
conf="$HESTIA/data/users/$ROOT_USER/overall_stats.log"
131131
if [ ! -e "$conf" ]; then
132132
touch $conf
133133
fi

0 commit comments

Comments
 (0)