Browse Source

fix ftp_add

master
VirtuBox 3 weeks ago
parent
commit
6e320528fb
Signed by: virtubox <thomas@virtubox.net> GPG Key ID: 22EB296C97BAD476
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      mybashrc

+ 6
- 2
mybashrc View File

@@ -472,13 +472,17 @@ _FTP_ADD() {
if [ "$#" = "0" ] || [ "$#" = "1" ]; then
echo "Usage : ftpadd <user> <domain>"
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

Loading…
Cancel
Save