bug- vesta/func /rebuild.sh (typo)

Post Reply
gathlete
Posts: 8
Joined: Sat Jan 06, 2024 8:15 am
Been thanked: 1 time

a bug in the rebuild_user_conf function. The bug is related to the shadow_str variable, which is used to update the password in the /etc/shadow file. The code incorrectly assigns the value of MD5 to shadow_str instead of the actual password hash.. bug is a typo in the code.
updated code: please review- the below code replace the assignment of MD5 with the actual password hash.

# Update password
shadow=$(grep ^$user: /etc/shadow)
shdw3=$(echo "$shadow" | cut -f3 -d :)
shdw4=$(echo "$shadow" | cut -f4 -d :)
shdw5=$(echo "$shadow" | cut -f5 -d :)
shdw6=$(echo "$shadow" | cut -f6 -d :)
shdw7=$(echo "$shadow" | cut -f7 -d :)
shdw8=$(echo "$shadow" | cut -f8 -d :)
shdw9=$(echo "$shadow" | cut -f9 -d :)
shadow_str="$user:$shdw2:$shdw3:$shdw4:$shdw5:$shdw6"
shadow_str="$shadow_str:$shdw7:$shdw8:$shdw9"
Post Reply