1
0
Fork 0
mirror of synced 2025-04-06 22:53:37 +03:00
setup-ipsec-vpn/adduser.sh
Peiying Yang(Brian) 197b9c3601 Update adduser.sh
2017-05-27 23:48:45 -04:00

19 lines
384 B
Bash

#!/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