mirror of
https://github.com/angristan/wireguard-install.git
synced 2024-11-24 05:56:02 +03:00
parent
21b5e56eea
commit
9fae7ad587
@ -275,11 +275,19 @@ function newClient() {
|
|||||||
CLIENT_PRE_SHARED_KEY=$(wg genpsk)
|
CLIENT_PRE_SHARED_KEY=$(wg genpsk)
|
||||||
|
|
||||||
# Home directory of the user, where the client configuration will be written
|
# Home directory of the user, where the client configuration will be written
|
||||||
if [ -e "/home/${CLIENT_NAME}" ]; then # if $1 is a user name
|
if [ -e "/home/${CLIENT_NAME}" ]; then
|
||||||
|
# if $1 is a user name
|
||||||
HOME_DIR="/home/${CLIENT_NAME}"
|
HOME_DIR="/home/${CLIENT_NAME}"
|
||||||
elif [ "${SUDO_USER}" ]; then # if not, use SUDO_USER
|
elif [ "${SUDO_USER}" ]; then
|
||||||
HOME_DIR="/home/${SUDO_USER}"
|
# if not, use SUDO_USER
|
||||||
else # if not SUDO_USER, use /root
|
if [ "${SUDO_USER}" == "root" ]; then
|
||||||
|
# If running sudo as root
|
||||||
|
HOME_DIR="/root"
|
||||||
|
else
|
||||||
|
HOME_DIR="/home/${SUDO_USER}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# if not SUDO_USER, use /root
|
||||||
HOME_DIR="/root"
|
HOME_DIR="/root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user