Skip to content

Instantly share code, notes, and snippets.

@jamesliu96
Created August 8, 2015 09:10
Show Gist options
  • Save jamesliu96/2634a5b6c6f8d3954a67 to your computer and use it in GitHub Desktop.
Save jamesliu96/2634a5b6c6f8d3954a67 to your computer and use it in GitHub Desktop.
PPTP CHAP account managing scripts
#!/bin/sh
if [ -z $1 ]; then
echo "Please specify username."
exit 1
fi
search=`grep '^'$1'' /etc/ppp/chap-secrets`
if [ -n $search ]; then
echo "Username already exists."
exit 1
fi
read passwd
echo "$1\tpptpd\t$passwd\t*" >> /etc/ppp/chap-secrets
#!/bin/sh
if [ -z $1 ]; then
echo "Please specify username."
exit 1
fi
if [ $1 = "admin" -o $1 = "test" ]; then
echo "Admin usernames are not allowed to modify."
exit 1
fi
sed -i '/^'$1'/d' /etc/ppp/chap-secrets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment