NND vsftpd郁闷了一天 » 荒野无灯weblog

Keep It Simple, Stupid.

荒野无灯weblog

NND vsftpd郁闷了一天

求虐,不用apt-get install vsftpd 安装 vsftpd,而是从源码编译安装。
结果果然被虐了。 :cool:

从ftp://vsftpd.beasts.org/users/cevans/下载2.3.2版的vsftpd:

wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.2.tar.gz
tar xvzf  vsftpd-2.3.2.tar.gz
cd vsftpd-2.3.2

做一些修改:

vim defs.h

修改#define VSFTP_DEFAULT_CONFIG “/etc/vsftpd.conf” 为

#define VSFTP_DEFAULT_CONFIG    "/etc/vsftpd/vsftpd.conf"

修改tunables.c 中void
tunables_load_defaults()中的一些默认值:

  tunable_use_localtime = 1;

  install_str_setting("/var/run/vsftpd", &tunable_secure_chroot_dir);

  install_str_setting("/etc/vsftpd/vsftpd.banned_emails", &tunable_banned_email_file);
  install_str_setting("/etc/vsftpd/vsftpd.chroot_list", &tunable_chroot_list_file);
  install_str_setting("/etc/vsftpd/vsftpd.user_list", &tunable_userlist_file);
  install_str_setting("/etc/vsftpd/vsftpd.email_passwords",
                      &tunable_email_password_file);

修改vsf_findlibs.sh内容为:

#!/bin/sh
# Cheesy hacky location of additional link libraries.

locate_library() { [ ! "$1*" = "`echo $1*`" ]; }
find_func() { egrep $1 $2 >/dev/null; }

locate_library /lib/libwrap.so.0 && echo "/lib/libwrap.so.0";

# Look for PAM (done weirdly due to distribution bugs (e.g. Debian) or the
# crypt library.
  locate_library /lib/libpam.so.0 && echo "/lib/libpam.so.0";

  locate_library /lib/libcrypt.so.1 && echo "/lib/libcrypt.so.1";

# Look for the dynamic linker library. Needed by older RedHat when
# you link in PAM

# Look for libnsl. Solaris needs this.
locate_library /lib/libnsl.so.1 && echo "/lib/libnsl.so.1";

# Look for libcap (capabilities)
if locate_library /lib/libcap.so.1; then
  echo "/lib/libcap.so.1";
elif locate_library /lib/libcap.so.2; then
  echo "/lib/libcap.so.2";
else
  locate_library /usr/lib/libcap.so && echo "-lcap";
  locate_library /lib/libcap.so && echo "-lcap";
  locate_library /lib64/libcap.so && echo "-lcap";
fi

# OpenSSL
locate_library /lib/libssl.so.0.9.8 && echo "/lib/libssl.so.0.9.8";
locate_library /lib/libcrypto.so.0.9.8 && echo "/lib/libcrypto.so.0.9.8";

locate_library /lib/libz.so.1 && echo "/lib/libz.so.1";

exit 0;

开始编译:

mkdir /var/run/vsftpd
mkdir /usr/local/man/man8/
mkdir /usr/local/man/man5/
make
make install

编译和安装没有出任何错。

[email protected]:~/vsftpd-2.3.2# ldd vsftpd
    linux-gate.so.1 =>  (0x00282000)
    libwrap.so.0 => /lib/libwrap.so.0 (0x00d60000)
    libpam.so.0 => /lib/libpam.so.0 (0x008b2000)
    libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0x008f3000)
    libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0x003ab000)
    libcap.so.2 => /lib/libcap.so.2 (0x0077c000)
    libssl.so.0.9.8 => /lib/i686/cmov/libssl.so.0.9.8 (0x00bd9000)
    libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0x00110000)
    libz.so.1 => /lib/libz.so.1 (0x002bd000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00def000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00262000)
    libattr.so.1 => /lib/libattr.so.1 (0x00266000)
    /lib/ld-linux.so.2 (0x00862000)

显示已经成功加载pam.
配置好虚拟用户后,启动:

/usr/local/sbin/vsftpd &

就是无法登录:

[email protected]:~/vsftpd-2.3.2# ftp 127.0.0.1
Connected to 127.0.0.1.
220 Welcome to ihacklog FTP service.
Name (127.0.0.1:root): haha
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.

/var/log/vsftpd.log无任何内容。

Tagged in :

All Comments (0)
Gravatar image
No Comments