19 lines
376 B
Bash
19 lines
376 B
Bash
#!/bin/bash
|
|
|
|
echo "Enter username"
|
|
read username
|
|
if grep "^"$username":" /etc/ipsec.d/passwd
|
|
then
|
|
echo "username exist"
|
|
exit 1
|
|
fi
|
|
echo "Enter password"
|
|
read 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
|