Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10504862
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:07:51


[root@localhost source]# tar xzvf vsftpd-2.0.7.tar.gz
[root@localhost source]# cd vsftpd-2.0.7
[root@localhost vsftpd-2.0.7]# more INSTALL
[root@localhost usr]# cd /home/source/vsftpd-2.0.7
[root@localhost vsftpd-2.0.7]# make
[root@localhost vsftpd-2.0.7]# make install
[root@localhost vsftpd-2.0.7]# cp vsftpd.conf /etc/
[root@localhost vsftpd-2.0.7]# cp RedHat/vsftpd.pam /etc/pam.d/vsftpd
[root@localhost vsftpd-2.0.7]# useradd -M ftp -d /var/ftp

[root@localhost vsftpd-2.0.7]# mkdir -p /var/ftp
[root@localhost vsftpd-2.0.7]# chown root:root /var/ftp
[root@localhost vsftpd-2.0.7]# chmod 755 /var/ftp
[root@localhost vsftpd-2.0.7]# mkdir -p /usr/share/empty
[root@localhost vsftpd-2.0.7]# more /etc/xinetd.d/vsftpd
# default: on
# description:
#   The vsftpd FTP server serves FTP connections. It uses
#   normal, unencrypted usernames and passwords for authentication.
# vsftpd is designed to be secure.
service ftp
{
        socket_type             = stream
        wait                    = no
        user                    = root
        server                  = /usr/local/sbin/vsftpd
#       server_args             =
#       log_on_success          += DURATION USERID
#       log_on_failure          += USERID
        nice                    = 10
        disable                 = YES
}
[root@localhost vsftpd-2.0.7]# cd /etc/
 
[root@localhost etc]# groupadd Virtual
You have new mail in /var/spool/mail/root
[root@localhost etc]# useradd -g Virtual Vuser
cd /etc
[root@localhost etc]# mkdir vsftpd
[root@localhost etc]# vi /etc/vsftpd/logins.txt
admin
123456
upload
12345678
download
12345678
                    
[root@localhost etc]# db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.db
[root@localhost etc]# chmod 600 /etc/vsftpd/vsftpd_login.db
[root@localhost etc]# cd pam.d/
[root@localhost pam.d]# more vsftpd
#%PAM-1.0
auth       required     /lib/security/pam_listfile.so item=user sense=deny file=
/etc/ftpusers onerr=succeed
auth       required     /lib/security/pam_unix.so shadow nullok
auth       required     /lib/security/pam_shells.so
account    required     /lib/security/pam_unix.so
session    required     /lib/security/pam_unix.so
[root@localhost pam.d]# vi vsftp.vu
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
[root@localhost pam.d]# mkdir /etc/vsftpd/Virtual
[root@localhost pam.d]# cd /etc/vsftpd/Virtual/
[root@localhost Virtul]# ls
[root@localhost Virtul]# vi admin
anon_world_readable_only=NO
write_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
anon_other_write_enable=YES
local_root=/home/web/
file_open_mode=0777 #此为上传文件具有X权限
                              
[root@localhost Virtul]# vi upload
anon_world_readable_only=NO
write_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
local_root=/usr/local/apache/htdocs/dym_test/
[root@localhost Virtul]# vi download
anon_world_readable_only=NO
local_root=/usr/local/apache/htdocs/anvy_test/
[root@localhost vsftpd]# cd ..
[root@localhost etc]# vi vsftpd.conf
[root@localhost etc]# more vsftpd.conf
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=NO
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=NO
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
listen=YES
listen_port=21
#tcp_wrappers=YES
chroot_local_user=YES
#userlist_enable=YES
guest_enable=YES
guest_username=Vuser
#virtual_use_local_privs=YES
pam_service_name=vsftp.vu
user_config_dir=/etc/vsftpd/Virtual
pasv_min_port=30000
pasv_max_port=30999
connect_timeout=180
max_clients=200
max_per_ip=100
[root@localhost etc]# /usr/local/sbin/vsftpd &
[1] 15190
[root@localhost etc]# ps -ef |grep vsftpd
root     15190 10536  0 18:17 pts/0    00:00:00 /usr/local/sbin/vsftpd
root     15192 10536  0 18:17 pts/0    00:00:00 grep vsftpd
[root@localhost htdocs]# ps -ef |grep vsftpd | awk '{print $2 }'
15190
15475
 

本文出自 “改造人” 博客,谢绝转载!

阅读(930) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~