1
0
Fork 0
mirror of synced 2025-04-05 06:03:33 +03:00
This commit is contained in:
Peiying Yang(Brian) 2017-06-04 20:00:18 +00:00 committed by GitHub
commit b5b3f0fdeb

19
adduser.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/bash
echo "Enter username"
read -r username
if grep "^$username:" /etc/ipsec.d/passwd
then
echo "Username already exist"
exit 1
fi
echo "Enter password"
read -r password
password=$(openssl passwd -1 "$password")
echo "$username:$password:xauth-psk" >> /etc/ipsec.d/passwd
if grep "^$username:" /etc/ipsec.d/passwd
then
echo "Success to add"
else
echo "Fail to add"
fi