Merge 197b9c3601
into bc0324f957
This commit is contained in:
commit
b5b3f0fdeb
1 changed files with 19 additions and 0 deletions
19
adduser.sh
Normal file
19
adduser.sh
Normal 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
|
Loading…
Add table
Reference in a new issue