yum安装vsftpd另一例
[
2015/09/17 14:58 | by admin ]
![不指定 不指定](images/weather/blank.gif)
使用yum安装vsftpd,打开所需的日志,并开启被动模式,脚本如下,另存为sh,直接运行即可。
#!/bin/bash
echo "--------------------------------vsftpd 自动安装脚本--------------------------------"
#Disable SeLinux
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
fi
setenforce 0
yum -y install vsftpd
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd/vsftpd.conf
sed -i 's\xferlog_std_format=YES\#xferlog_std_format=YES\' /etc/vsftpd/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd/vsftpd.conf
echo "dual_log_enable=YES" >>/etc/vsftpd/vsftpd.conf
echo "vsftpd_log_file=/var/log/vsftpd.log" >>/etc/vsftpd/vsftpd.conf
echo "listen_port=21" >>/etc/vsftpd/vsftpd.conf
echo "pasv_enable=YES" >>/etc/vsftpd/vsftpd.conf
echo "pasv_min_port=20000" >>/etc/vsftpd/vsftpd.conf
echo "pasv_max_port=20500" >>/etc/vsftpd/vsftpd.conf
mkdir -p /wwwroot/htdocs
groupadd www
useradd www -g www -d /wwwroot/htdocs -s /sbin/nologin
passwd www
chown www.www /wwwroot/htdocs
chkconfig vsftpd on
service vsftpd start
echo "--------------------------------vsftpd 安装说明------------------------------------"
echo "| |"
echo "| 用户为 www 密码为刚才所设 FTP根目录为/wwwroot/htdocs |"
echo "| 新增用户样例为(新增用户ktm):useradd ktm -g www -d /wwwroot/ktm -s /sbin/nologin |"
echo "| service vsftpd restart |"
echo "| |"
echo "--------------------------------vsftpd 安装结束!-----------------------------------"
sleep 2
防火墙就不直接更改了,注意另外打开端口20000-20050即可
#!/bin/bash
echo "--------------------------------vsftpd 自动安装脚本--------------------------------"
#Disable SeLinux
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
fi
setenforce 0
yum -y install vsftpd
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd/vsftpd.conf
sed -i 's\xferlog_std_format=YES\#xferlog_std_format=YES\' /etc/vsftpd/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd/vsftpd.conf
echo "dual_log_enable=YES" >>/etc/vsftpd/vsftpd.conf
echo "vsftpd_log_file=/var/log/vsftpd.log" >>/etc/vsftpd/vsftpd.conf
echo "listen_port=21" >>/etc/vsftpd/vsftpd.conf
echo "pasv_enable=YES" >>/etc/vsftpd/vsftpd.conf
echo "pasv_min_port=20000" >>/etc/vsftpd/vsftpd.conf
echo "pasv_max_port=20500" >>/etc/vsftpd/vsftpd.conf
mkdir -p /wwwroot/htdocs
groupadd www
useradd www -g www -d /wwwroot/htdocs -s /sbin/nologin
passwd www
chown www.www /wwwroot/htdocs
chkconfig vsftpd on
service vsftpd start
echo "--------------------------------vsftpd 安装说明------------------------------------"
echo "| |"
echo "| 用户为 www 密码为刚才所设 FTP根目录为/wwwroot/htdocs |"
echo "| 新增用户样例为(新增用户ktm):useradd ktm -g www -d /wwwroot/ktm -s /sbin/nologin |"
echo "| service vsftpd restart |"
echo "| |"
echo "--------------------------------vsftpd 安装结束!-----------------------------------"
sleep 2
防火墙就不直接更改了,注意另外打开端口20000-20050即可
vsftpd2.3.4 源码安装脚本
[
2011/04/01 21:06 | by admin ]
![不指定 不指定](images/weather/blank.gif)
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com
下载文件 (已下载 178 次)
本安装为vsftpd2.3.4源码包安装,安装环境为centos5.5 32位,安装过程中创建ftp用户为:www,密码为:123654,并打开日志,日志为:/var/log/vsftpd.log 和 :/var/log/xferlog
下面为安装脚本,也可以直接下载附件包上传后进行安装。
#!/bin/bash
clear
echo "----------------源码安装vsftpd安装程序,按任意键继续----------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "本安装为本地用户登录FTP,并开启日志,请按任意键继续......"
char=`get_char`
mkdir -p /usr/local/man/man8/
mkdir -p /usr/local/man/man5/
tar zxvf vsftpd-2.3.4.tar.gz
cd vsftpd-2.3.4
make
make install
cp vsftpd.conf /etc/
#touch /etc/vsftpd.chroot_list
touch /etc/ftpusers
cat >>/etc/ftpusers<<EOF
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
mysql
EOF
touch /var/log/vsftpd.log
cp RedHat/vsftpd.pam /etc/pam.d/vsftpd
cp ../vsftpd /etc/rc.d/init.d/
chmod 755 /etc/rc.d/init.d/vsftpd
chkconfig --add vsftpd
chkconfig vsftpd on
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd.conf
sed -i 's\#local_enable=YES\local_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#write_enable=YES\write_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#local_umask=022\local_umask=022\g' /etc/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to xiaoyuwxzs FTP service.\g' /etc/vsftpd.conf
sed -i 's\dirmessage_enable=YES\#dirmessage_enable=YES\g' /etc/vsftpd.conf
sed -i 's\xferlog_enable=YES\#xferlog_enable=YES\g' /etc/vsftpd.conf
echo "dual_log_enable=YES" >>/etc/vsftpd.conf
echo "vsftpd_log_file=/var/log/vsftpd.log" >>/etc/vsftpd.conf
sed -i 's\connect_from_port_20=YES\#connect_from_port_20=YES\g' /etc/vsftpd.conf
echo "pam_service_name=vsftpd" >>/etc/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd.conf
echo "增加www用户组,并增加www用户,www家目录设为/home/wwwroot/"
sleep2
groupadd www
useradd www -g www -d /home/wwwroot/ -s /sbin/nologin
echo "123654" | passwd --stdin www
chown www.www /home/wwwroot/
service vsftpd start
sleep 1
echo "删除安装临时文件.............."
rm -Rf vsftpd-2.3.4
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| useradd 用户名 -g 用户组 -d 用户家目录 -s /sbin/nologin |"
echo "| 如需禁用用户,增加用户名到 /etc/ftpusers |"
sleep 1
echo " -------------------------- vsftpd 安装结束! --------------------------"
echo
本文来自http://blog.gsywx.com
![](template/marshalv3m/images/download.gif)
本安装为vsftpd2.3.4源码包安装,安装环境为centos5.5 32位,安装过程中创建ftp用户为:www,密码为:123654,并打开日志,日志为:/var/log/vsftpd.log 和 :/var/log/xferlog
下面为安装脚本,也可以直接下载附件包上传后进行安装。
#!/bin/bash
clear
echo "----------------源码安装vsftpd安装程序,按任意键继续----------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "本安装为本地用户登录FTP,并开启日志,请按任意键继续......"
char=`get_char`
mkdir -p /usr/local/man/man8/
mkdir -p /usr/local/man/man5/
tar zxvf vsftpd-2.3.4.tar.gz
cd vsftpd-2.3.4
make
make install
cp vsftpd.conf /etc/
#touch /etc/vsftpd.chroot_list
touch /etc/ftpusers
cat >>/etc/ftpusers<<EOF
root
bin
daemon
adm
lp
sync
shutdown
halt
news
uucp
operator
games
nobody
mysql
EOF
touch /var/log/vsftpd.log
cp RedHat/vsftpd.pam /etc/pam.d/vsftpd
cp ../vsftpd /etc/rc.d/init.d/
chmod 755 /etc/rc.d/init.d/vsftpd
chkconfig --add vsftpd
chkconfig vsftpd on
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd.conf
sed -i 's\#local_enable=YES\local_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#write_enable=YES\write_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#local_umask=022\local_umask=022\g' /etc/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to xiaoyuwxzs FTP service.\g' /etc/vsftpd.conf
sed -i 's\dirmessage_enable=YES\#dirmessage_enable=YES\g' /etc/vsftpd.conf
sed -i 's\xferlog_enable=YES\#xferlog_enable=YES\g' /etc/vsftpd.conf
echo "dual_log_enable=YES" >>/etc/vsftpd.conf
echo "vsftpd_log_file=/var/log/vsftpd.log" >>/etc/vsftpd.conf
sed -i 's\connect_from_port_20=YES\#connect_from_port_20=YES\g' /etc/vsftpd.conf
echo "pam_service_name=vsftpd" >>/etc/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd.conf
echo "增加www用户组,并增加www用户,www家目录设为/home/wwwroot/"
sleep2
groupadd www
useradd www -g www -d /home/wwwroot/ -s /sbin/nologin
echo "123654" | passwd --stdin www
chown www.www /home/wwwroot/
service vsftpd start
sleep 1
echo "删除安装临时文件.............."
rm -Rf vsftpd-2.3.4
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| useradd 用户名 -g 用户组 -d 用户家目录 -s /sbin/nologin |"
echo "| 如需禁用用户,增加用户名到 /etc/ftpusers |"
sleep 1
echo " -------------------------- vsftpd 安装结束! --------------------------"
echo
vsftpd通过DB验证虚拟用户配置2用户安装脚本
[
2010/07/17 10:37 | by admin ]
![不指定 不指定](images/weather/blank.gif)
脚本仅作参考,具体为什么,请参考vsftpd配置文件,转载请注明地址,谢谢
附件此脚本服务控制脚本.
下载文件 (已下载 255 次)
#!/bin/bash
clear
echo "----------------源码安装vsftpd安装程序,按任意键继续----------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "本安装为配置tom和jack两虚拟用户登录各自的目录,请按任意键继续......"
char=`get_char`
mkdir -p /usr/local/man/man8/
mkdir -p /usr/local/man/man5/
tar zxvf vsftpd-2.2.2.tar.gz
cd vsftpd-2.2.2
make
make install
cp vsftpd.conf /etc/
touch /etc/vsftpd.chroot_list
touch /etc/ftpusers
cp RedHat/vsftpd.pam /etc/pam.d/vsftpd
cp ../vsftpd /etc/rc.d/init.d/
chmod 755 /etc/rc.d/init.d/vsftpd
chkconfig --add vsftpd
chkconfig vsftpd on
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd.conf
sed -i 's\#local_enable=YES\local_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#write_enable=YES\write_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#local_umask=022\local_umask=022\g' /etc/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to xiaoyuwxzs FTP service.\g' /etc/vsftpd.conf
sed -i 's\dirmessage_enable=YES\#dirmessage_enable=YES\g' /etc/vsftpd.conf
sed -i 's\xferlog_enable=YES\#xferlog_enable=YES\g' /etc/vsftpd.conf
sed -i 's\connect_from_port_20=YES\#connect_from_port_20=YES\g' /etc/vsftpd.conf
echo "pam_service_name=vsftpd" >>/etc/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd.conf
echo "guest_enable=YES " >>/etc/vsftpd.conf
echo "guest_username=virtualuser" >>/etc/vsftpd.conf
echo "virtual_use_local_privs=YES" >>/etc/vsftpd.conf
echo "user_config_dir=/etc/vftp" >>/etc/vsftpd.conf
#修改pam认证文件
sed -i 's\auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed\#auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed\g' /etc/pam.d/vsftpd
sed -i 's\auth required /lib/security/pam_unix.so shadow nullok\#auth required /lib/security/pam_unix.so shadow nullok\g' /etc/pam.d/vsftpd
sed -i 's\auth required /lib/security/pam_shells.so\#auth required /lib/security/pam_shells.so\g' /etc/pam.d/vsftpd
sed -i 's\account required /lib/security/pam_unix.so\#account required /lib/security/pam_unix.so\g' /etc/pam.d/vsftpd
sed -i 's\session required /lib/security/pam_unix.so\#session required /lib/security/pam_unix.so\g' /etc/pam.d/vsftpd
echo "auth required /lib/security/pam_userdb.so db=/etc/vsftpd_login" >>/etc/pam.d/vsftpd
echo "account required /lib/security/pam_userdb.so db=/etc/vsftpd_login" >>/etc/pam.d/vsftpd
useradd virtualuser -d /home/virtualuser -s /sbin/nologin
rpm -ivh db4*
touch /login.txt
echo "tom" >>/login.txt
echo "123456" >>/login.txt
echo "jack" >>/login.txt
echo "654321" >>/login.txt
db_load -T -t hash -f /login.txt /etc/vsftpd_login.db
chmod 600 /etc/vsftpd_lofgin.db
mkdir /etc/vftp
touch /etc/vftp/tom
echo "local_root=/home/tom" >>/etc/vftp/tom
touch /etc/vftp/jack
echo "local_root=/home/jack" >>/etc/vftp/jack
mkdir /home/tom
mkdir /home/jack
chown virtualuser.virtualuser /home/tom
chown virtualuser.virtualuser /home/jack
chmod 700 /home/tom
chmod 700 /home/jack
service vsftpd start
sleep 1
echo "删除安装临时文件.............."
rm -Rf vsftpd-2.2.2
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| echo "用户名" >>/login.txt |"
echo "| echo "密码" >>/login.txt |"
echo "| db_load -T -t hash -f /login.txt /etc/vsftpd_login.db |"
echo "| touch /etc/vftp/用户名 |"
echo "| mkdir /home/用户名 |"
echo "| chown virtualuser.virtualuser /home/用户名 |"
echo "| chmod 700 /home/用户名 |"
echo "| echo "local_root=/home/用户名" >>/etc/vftp/jack/用户名 |"
echo "| service vsftpd start |"
echo "| 如需禁用用户,增加用户名到 /etc/ftpusers |"
echo " -------------------------- vsftpd 安装结束! --------------------------"
sleep 1
附件此脚本服务控制脚本.
![](template/marshalv3m/images/download.gif)
#!/bin/bash
clear
echo "----------------源码安装vsftpd安装程序,按任意键继续----------------"
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "本安装为配置tom和jack两虚拟用户登录各自的目录,请按任意键继续......"
char=`get_char`
mkdir -p /usr/local/man/man8/
mkdir -p /usr/local/man/man5/
tar zxvf vsftpd-2.2.2.tar.gz
cd vsftpd-2.2.2
make
make install
cp vsftpd.conf /etc/
touch /etc/vsftpd.chroot_list
touch /etc/ftpusers
cp RedHat/vsftpd.pam /etc/pam.d/vsftpd
cp ../vsftpd /etc/rc.d/init.d/
chmod 755 /etc/rc.d/init.d/vsftpd
chkconfig --add vsftpd
chkconfig vsftpd on
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd.conf
sed -i 's\#local_enable=YES\local_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#write_enable=YES\write_enable=YES\g' /etc/vsftpd.conf
sed -i 's\#local_umask=022\local_umask=022\g' /etc/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to xiaoyuwxzs FTP service.\g' /etc/vsftpd.conf
sed -i 's\dirmessage_enable=YES\#dirmessage_enable=YES\g' /etc/vsftpd.conf
sed -i 's\xferlog_enable=YES\#xferlog_enable=YES\g' /etc/vsftpd.conf
sed -i 's\connect_from_port_20=YES\#connect_from_port_20=YES\g' /etc/vsftpd.conf
echo "pam_service_name=vsftpd" >>/etc/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd.conf
echo "guest_enable=YES " >>/etc/vsftpd.conf
echo "guest_username=virtualuser" >>/etc/vsftpd.conf
echo "virtual_use_local_privs=YES" >>/etc/vsftpd.conf
echo "user_config_dir=/etc/vftp" >>/etc/vsftpd.conf
#修改pam认证文件
sed -i 's\auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed\#auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed\g' /etc/pam.d/vsftpd
sed -i 's\auth required /lib/security/pam_unix.so shadow nullok\#auth required /lib/security/pam_unix.so shadow nullok\g' /etc/pam.d/vsftpd
sed -i 's\auth required /lib/security/pam_shells.so\#auth required /lib/security/pam_shells.so\g' /etc/pam.d/vsftpd
sed -i 's\account required /lib/security/pam_unix.so\#account required /lib/security/pam_unix.so\g' /etc/pam.d/vsftpd
sed -i 's\session required /lib/security/pam_unix.so\#session required /lib/security/pam_unix.so\g' /etc/pam.d/vsftpd
echo "auth required /lib/security/pam_userdb.so db=/etc/vsftpd_login" >>/etc/pam.d/vsftpd
echo "account required /lib/security/pam_userdb.so db=/etc/vsftpd_login" >>/etc/pam.d/vsftpd
useradd virtualuser -d /home/virtualuser -s /sbin/nologin
rpm -ivh db4*
touch /login.txt
echo "tom" >>/login.txt
echo "123456" >>/login.txt
echo "jack" >>/login.txt
echo "654321" >>/login.txt
db_load -T -t hash -f /login.txt /etc/vsftpd_login.db
chmod 600 /etc/vsftpd_lofgin.db
mkdir /etc/vftp
touch /etc/vftp/tom
echo "local_root=/home/tom" >>/etc/vftp/tom
touch /etc/vftp/jack
echo "local_root=/home/jack" >>/etc/vftp/jack
mkdir /home/tom
mkdir /home/jack
chown virtualuser.virtualuser /home/tom
chown virtualuser.virtualuser /home/jack
chmod 700 /home/tom
chmod 700 /home/jack
service vsftpd start
sleep 1
echo "删除安装临时文件.............."
rm -Rf vsftpd-2.2.2
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "| echo "用户名" >>/login.txt |"
echo "| echo "密码" >>/login.txt |"
echo "| db_load -T -t hash -f /login.txt /etc/vsftpd_login.db |"
echo "| touch /etc/vftp/用户名 |"
echo "| mkdir /home/用户名 |"
echo "| chown virtualuser.virtualuser /home/用户名 |"
echo "| chmod 700 /home/用户名 |"
echo "| echo "local_root=/home/用户名" >>/etc/vftp/jack/用户名 |"
echo "| service vsftpd start |"
echo "| 如需禁用用户,增加用户名到 /etc/ftpusers |"
echo " -------------------------- vsftpd 安装结束! --------------------------"
sleep 1
vsftpd安装脚本方法二(yum安装)
[
2010/07/17 10:26 | by admin ]
![不指定 不指定](images/weather/blank.gif)
较前一vsftpd安装脚本(yum安装) 改了本地用户验证方式,添加用户时不用再向chroot文件添加用户名
具体脚本如下:
#!/bin/bash
echo "--------------------------------vsftpd 自动安装脚本--------------------------------"
yum -y install vsftpd
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to my vsftpd FTP service.\g' /etc/vsftpd/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd/vsftpd.conf
mkdir -p /wwwroot/htdocs
groupadd www
useradd www -g www -d /wwwroot/htdocs -s /sbin/nologin
passwd www
chown www.www /wwwroot/htdocs
chkconfig vsftpd on
service vsftpd start
echo "--------------------------------vsftpd 安装说明------------------------------------"
echo "| |"
echo "| 用户为 www 密码为刚才所设 FTP根目录为/wwwroot/htdocs |"
echo "| 新增用户样例为(新增用户ktm):useradd ktm -g www -d /wwwroot/ktm -s /sbin/nologin |"
echo "| service vsftpd restart |"
echo "| |"
echo "--------------------------------vsftpd 安装结束!-----------------------------------"
sleep 2
具体脚本如下:
#!/bin/bash
echo "--------------------------------vsftpd 自动安装脚本--------------------------------"
yum -y install vsftpd
sed -i 's#anonymous_enable=YES#anonymous_enable=NO#' /etc/vsftpd/vsftpd.conf
sed -i 's\#ftpd_banner=Welcome to blah FTP service.\ftpd_banner=Welcome to my vsftpd FTP service.\g' /etc/vsftpd/vsftpd.conf
echo "chroot_local_user=YES" >>/etc/vsftpd/vsftpd.conf
mkdir -p /wwwroot/htdocs
groupadd www
useradd www -g www -d /wwwroot/htdocs -s /sbin/nologin
passwd www
chown www.www /wwwroot/htdocs
chkconfig vsftpd on
service vsftpd start
echo "--------------------------------vsftpd 安装说明------------------------------------"
echo "| |"
echo "| 用户为 www 密码为刚才所设 FTP根目录为/wwwroot/htdocs |"
echo "| 新增用户样例为(新增用户ktm):useradd ktm -g www -d /wwwroot/ktm -s /sbin/nologin |"
echo "| service vsftpd restart |"
echo "| |"
echo "--------------------------------vsftpd 安装结束!-----------------------------------"
sleep 2