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

19 lines
386 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