diff --git a/wireguard-install.sh b/wireguard-install.sh index 150172b..5319d79 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -247,8 +247,8 @@ function newClient() { CLIENT_PRE_SHARED_KEY=$(wg genpsk) # Home directory of the user, where the client configuration will be written - if [ -e "/home/$CLIENT" ]; then # if $1 is a user name - HOME_DIR="/home/$CLIENT" + if [ -e "/home/${CLIENT_NAME}" ]; then # if $1 is a user name + HOME_DIR="/home/${CLIENT_NAME}" elif [ "${SUDO_USER}" ]; then # if not, use SUDO_USER HOME_DIR="/home/${SUDO_USER}" else # if not SUDO_USER, use /root