From 6e320528fbe1cde682b57633c81cabd37efa0d11 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 18 Oct 2019 17:32:44 +0200 Subject: [PATCH] fix ftp_add --- mybashrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mybashrc b/mybashrc index f508a52..d4e1456 100644 --- a/mybashrc +++ b/mybashrc @@ -472,13 +472,17 @@ _FTP_ADD() { if [ "$#" = "0" ] || [ "$#" = "1" ]; then echo "Usage : ftpadd " else + if ! command_exists pwgen; then + apt_install pwgen + fi ftpaccountpass=$(_PWGEN) - echo "user : $1" - echo "password : $ftpaccountpass" if [ -d /var/www/"$2"/htdocs ]; then $NEED_SUDO useradd -d /var/www/"$2"/htdocs -M -s /bin/false -G www-data "$1" echo "$1:$ftpaccountpass" | $NEED_SUDO chpasswd -m chmod -R g+rw /var/www/"$2"/htdocs + echo -e "\n\n [/var/www/$2/htdocs]" | tee -a "$HOME/.ftpaccounts" + echo -e "user : $1" | tee -a "$HOME/.ftpaccounts" + echo "password : $ftpaccountpass" | tee -a "$HOME/.ftpaccounts" else echo "site directory doesn't exist" fi