2

我需要一个shell脚本来测试新用户确实可以在proftpd中使用被动操作模式上传和下载文件。我在/tmp上安装了proftpd,配置文件是/etc/proftpd.conf。请大家帮帮我

 #! /bin/bash
#decompress the file 
mkdir /opt/$1
cd /opt/$1
wget http://ftp.swin.edu.au/proftpd/distrib/source/proftpd-1.3.3e.tar.gz
tar -xzf proftpd-1.3.3e.tar.gz
#configure it 
cd proftpd-1.3.3e
./configure --sysconfdir=/opt
#Make the file
make
#make install the extracted file
make install
#To add ftp user,group
useradd $2
groupadd $2
mkdir /home/$3
passwd $2
echo "User  $3 ">> /opt/proftpd.conf
echo "Group $3 ">> /opt/proftpd.conf
echo "DefaultRoot  ~ " >> /opt/proftpd.conf
echo "PassivePorts 30000 35000 ">> /opt/proftpd.conf
exit                                                     
4

1 回答 1

0
    echo -n "Enter FTP Username : " 
    read USER 
    echo -n "Enter password : " 
    read -s PASSWD 

    HOST='192.168.1.100' 
    ftp -n -v $HOST << EOT 
    ascii 
    user $USER $PASSWD 
    prompt 
    put file.txt 
    get file.txt 
    ls -la 
    bye 
    EOT 
于 2016-07-14T08:45:52.793 回答