1、卸载之前系统带的(如果有或者自己apt-get了)
2、下载vsftpd源代码
然后编译安装
3、重新配置/etc/vsftpd.conf
- # cat /dev/null > /etc/vsftpd.conf
下面是我的配置(编译时没有打开ssl选项,就没有配置ssl选项)
- local_enable=YES
- write_enable=YES
- dirmessage_enable=YES
- xferlog_enable=YES
- xferlog_std_format=YES
- log_ftp_protocol=YES
- connect_from_port_20=YES
- ascii_upload_enable=YES
- ascii_download_enable=YES
- listen=YES
- listen_port=21
- pasv_min_port=30000
- pasv_max_port=30100
- local_umask=007
- ftp_username=nobody
- ftpd_banner="FTP ONLY."
- anonymous_enable=NO
- check_shell=NO
- secure_chroot_dir=/usr/share/empty
4、创建/usr/share/empty
- mkdir -p /usr/share/empty
5、启动vsftpd服务
- /opt/3rdTools/bin/vsftpd &
6、验证FTP登录功能
- # ftp localhost
- Connected to localhost.
- 220 "FTP ONLY."
- Name (localhost:root): root
- 331 Please specify the password.
- Password:
- 230 Login successful.
- Remote system type is UNIX.
- Using binary mode to transfer files.
- ftp>
7、创建自启动脚本
- # cd /etc/init.d
- # touch vsftpd
- # chmod +x vsftpd
- # cd ../rc2.d
- # ln -s ../init.d/vsftpd S99vsftpd
下面是我的vsftpd脚本
- #!/bin/bash
- #
- # description: Starts and stops the vsftpd
- #
- test -x /opt/mTool/3rdTools/bin/vsftpd || {
- echo "vsftpd not properly installed"
- exit 1
- }
- RETVAL=0
- start() {
- KIND="vsftpd"
- echo -n $"Starting vsftpd .."
- /opt/mTool/3rdTools/bin/vsftpd &
- echo "."
- return 0
- }
- stop() {
- echo -n $"Shutting down vsftpd .."
- for pid in `ps -ef | grep /opt/mTool/3rdTools/bin/vsftpd | grep -v grep | awk '{print $2}'`
- do
- kill -9 $pid
- done
- echo "."
- return 0
- }
- restart() {
- stop
- sleep 3
- start
- }
- status() {
- if [ -z "`ps -ef | grep /opt/mTool/3rdTools/bin/vsftpd | grep -v grep`" ]; then
- echo "vsftpd not started."
- else
- ps -ef | grep /opt/mTool/3rdTools/bin/vsftpd | grep -v grep
- fi
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- status)
- status
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|status}"
- exit 1
- esac
- exit $?
阅读(1432) | 评论(0) | 转发(1) |