Skip to content

Instantly share code, notes, and snippets.

Created November 14, 2013 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/471b4cba209603e8e696 to your computer and use it in GitHub Desktop.
Save anonymous/471b4cba209603e8e696 to your computer and use it in GitHub Desktop.
#!/bin/bash
FTP_USER="$1";
FTP_PASSWD_FILE="/etc/pure-ftpd/pureftpd.passwd";
CHECK_LOGIN=`cat "$FTP_PASSWD_FILE" | grep "$FTP_USER:" | cut -d ':' -f 1 | wc -l`;
DieWithError()
{
echo "$1" 1>&2;
exit 1;
}
[ -z "$FTP_USER" ] && DieWithError "Usage: $0 <ftp_login>";
[ $CHECK_LOGIN -eq 0 ] && DieWithError "Error: the specified login does not exist";
pure-pw userdel "${FTP_USER}" 2> /dev/null;
pure-pw mkdb > /dev/null 2>&1;
/etc/init.d/pure-ftpd restart > /dev/null 2>&1;
echo -e "Done!\n";
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment