1.下载
ftp://vsftpd.beasts.org/users/cevans/vsftpd-1.2.1.tar.gz
2.安装
#make
$ ls -l vsftpd
-rwxrwxr-x 1 chris chris 61748 Sep 27 00:26 vsftpd
如果系统没有nobody用户,请增加nobody用户
[root@localhost root]# useradd nobody
useradd: user nobody exists
如果系统没有/usr/share/empty/目录,请建立该目录
[root@localhost root]# mkdir /usr/share/empty/
mkdir: cannot create directory `/usr/share/empty': File exists
建立/var/ftp/目录,并建立ftp用户
[root@rhel4 vsftpd-1.2.1]# ll /var/ftp/
ls: /var/ftp/: 没有那个文件或目录
[root@rhel4 vsftpd-1.2.1]#
[root@rhel4 vsftpd-1.2.1]# mkdir /var/ftp/
[root@rhel4 vsftpd-1.2.1]# useradd -d /var/ftp ftp
useradd: user ftp exists
如果系统已有ftp用户,则请执行
[root@rhel4 vsftpd-1.2.1]# chown root.root /var/ftp
[root@rhel4 vsftpd-1.2.1]# chmod og-w /var/ftp
编译安装,如果make install出现以下错误请修改Makefile
[root@rhel4 vsftpd-1.2.1]# make install
if [ -x /usr/local/sbin ]; then \
install -m 755 vsftpd /usr/local/sbin/vsftpd; \
else \
install -m 755 vsftpd /usr/sbin/vsftpd; fi
if [ -x /usr/local/man ]; then \
install -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \
elif [ -x /usr/share/man ]; then \
install -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \
else \
install -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \
install -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi
install: 无法创建一般文件‘/usr/local/man/man8/vsftpd.8’: 没有那个文件或目录
install: 无法创建一般文件‘/usr/local/man/man5/vsftpd.conf.5’: 没有那个文件或目录
[root@rhel4 vsftpd-1.2.1]# vi Makefile
install:
if [ -x /usr/local/sbin ]; then \
$(INSTALL) -m 755 vsftpd /usr/local/sbin/vsftpd; \
else \
$(INSTALL) -m 755 vsftpd /usr/sbin/vsftpd; fi
if [ -x /usr/share/man ]; then \
$(INSTALL) -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \
elif [ -x /usr/local/man ]; then \
$(INSTALL) -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \
else \
$(INSTALL) -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi
if [ -x /etc/xinetd.d ]; then \
$(INSTALL) -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi
[root@rhel4 vsftpd-1.2.1]# cp vsftpd.conf /etc
复制PAM验证文件,以允许本地用户登录VSFTPD。
[root@rhel4 vsftpd-1.2.1]# cp RedHat/vsftpd.pam /etc/pam.d/ftp
3.允许本地用户登陆
取消vsftpd.conf以下三行的注释:
local_enable=YES
write_enable=YES
local_umask=022
4.测试
[root@rhel4 vsftpd-1.2.1]# vi /etc/vsftpd.conf
在配置文件最后增加如下一行:
listen=YES
[root@rhel4 vsftpd-1.2.1]# /usr/local/sbin/vsftpd &
[1] 25452
[root@rhel4 vsftpd-1.2.1]# ftp localhost
Connected to rhel4.newsky.cn.
220 (vsFTPd 1.2.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,194,146)
150 Here comes the directory listing.
226 Directory send OK.
ftp> mkdir asdf
550 Permission denied.
ftp> ls
227 Entering Passive Mode (127,0,0,1,51,231)
150 Here comes the directory listing.
226 Directory send OK.
ftp> exit
?Invalid command
ftp> quit
221 Goodbye.