由于最及网络卡的很 ssl连接基本连不上所以改用ftp了。下面就是在64位操作系统上安装vsftp
下载地址是ftp://vsftpd.beasts.org/users/cevans/
目前最新版本是2。20 吧
我习惯2.04 所以就用2.04了
[root@v70.us software]#wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.4.tar.gz
[root@v70.us software]#tar zxvf vsftpd-2.0.4.tar.gz
[root@v70.us software]#cd vsftpd-2.0.4
因为实在64位操作系统上安装 所以要打个补丁 2.20是不用2.04是一定要 其他版本不详
如果编译到sysdeputil文件时出现如下错误
specified for parameter 'sendfile'
sysdeputil.c:186: error: storage class specified for parameter 'environ'
sysdeputil.c:187: error: storage class specified for parameter 's_proctitle_space'
sysdeputil.c:187: error: parameter 's_proctitle_space' is initialized
sysdeputil.c:188: error: storage class specified for parameter 's_proctitle_inited'
sysdeputil.c:188: error: parameter 's_proctitle_inited' is initialized
sysdeputil.c:189: error: storage class specified for parameter 's_p_proctitle'
sysdeputil.c:189: error: parameter 's_p_proctitle' is initialized
sysdeputil.c:201: error: storage class specified for parameter 'do_sendfile'
sysdeputil.c:202: error: storage class specified for parameter 'vsf_sysutil_setproctitle_internal'
sysdeputil.c:203: error: storage class specified for parameter 's_proctitle_prefix_str'
sysdeputil.c:278: error: storage class specified for parameter 's_pamh'
sysdeputil.c:279: error: storage class specified for parameter 's_pword_str'
sysdeputil.c:281: error: storage class specified for parameter 'pam_conv_func'
sysdeputil.c:282: error: storage class specified for parameter 'vsf_auth_shutdown'
sysdeputil.c:288: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:383: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:398: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:436: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:474: error: storage class specified for parameter 'do_checkcap'
sysdeputil.c:478: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:497: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:514: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:527: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:604: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:641: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:796: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:803: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:809: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:856: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:889: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:930: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:935: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:976: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1012: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1128: error: storage class specified for parameter 's_uwtmp_inserted'
sysdeputil.c:1129: error: storage class specified for parameter 's_utent'
sysdeputil.c:1134: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1173: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
sysdeputil.c:1189: error: old-style parameter declarations in prototyped function definition
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:162: error: parameter name omitted
sysdeputil.c:1189: error: expected '{' at end of input
make: *** [sysdeputil.o] Error 1
就需要打补丁了
不打补丁的跳过这步
=========================================
[root@v70.us vsftpd-2.0.4]#wget http://linuxfromscratch.org/pipermail/lfs-dev/attachments/20061019/fd9b9f56/attachment.bin
[root@v70.us vsftpd-2.0.4]#patch sysdeputil.c attachment.bin
====================================================
64位的话make 还会出错是找不到 /lib/libpam.so,这个需要更改文件vsf_findlibs.sh
把第15行(我的文件是15行)locate_library /lib/libpam.so.0 && echo "/lib/libpam.so.0";中的lib 改成 lib64
如locate_library /lib64/libpam.so.0 && echo "/lib64/libpam.so.0";
[root@v70.us vsftpd-2.0.4]#make &&make install
安装完成 最后如果出现man config无法安装不用管了
反正用的也是自己的配置
安装到这里就结束了
下面该是配置了
一般都是pam+db数据库吧 然后使用虚拟用户映射到本地用户
添加ftp 用户 useradd -d /data0/ftp -s /sbin/nologin vsftpd
mkdir /data0/ftp
chown /data0/ftp ftp
然后编写pam文件
如果是32位系统就用 example里面的就ok了
如下 vi / etc/pam.d/vsftpd.pam
auth required /lib/security/pam_userdb.so db=/etc/vsftp/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftp/vsftpd_login
如果是64位的加个64就ok了 如下
auth required /lib64/security/pam_userdb.so db=/etc/vsftp/vsftpd_login
account required /lib64/security/pam_userdb.so db=/etc/vsftp/vsftpd_login
这样pam就ok了
然后配置vsftp的配置文件
vsftp的配置目录在/etc/vsftp/
建议一个vsftpd.conf
vi /etc/vsftp/vsftpd.conf
必须写入
guest_username=ftp 这句是用户映射 使用ftp作为虚拟用户
pam_service_name=vsftpd.pam 这句是调用pma
其他的就按自己实际情况来写了
具体的看。。。
下面的是我自己用的 具体的先不解释了 最好别用我的 我的是如果不在user_list.ftp1加入用户名的话是不能登陆的
加了用户名后还要在/etc/vsftp/ftp1_userconf/ 建立一个是用户名的文件设置具体的权限
guest_enable=YES
pam_service_name=vsftpd.pam
anonymous_enable=NO
local_enable=YES
write_enable=no
local_umask=022
dirmessage_enable=YES
xferlog_enable=no
connect_from_port_20=YES
chroot_local_user=YES
guest_username=ftp
userlist_enable=YES
userlist_deny=no
userlist_file=/etc/vsftp/user_list.ftp1
listen=yes
listen_port=21
tcp_wrappers=no
virtual_use_local_privs=YES
chroot_local_user=YES
chroot_list_enable=yes
chroot_list_file=/etc/vsftp/chroot_list.ftp1
ascii_download_enable=yes
ascii_upload_enable=yes
pasv_max_port=6000
pasv_min_port=5000
user_config_dir=/etc/vsftp/ftp1_userconf/
ftpd_banner=welcome to coshim
用虚拟用的话还有建立db数据库下面开始建立db数据库
先安装
yum -y install db4 db4-utils
然后 进入目录/etc/vsftp/
cd /etc/vsftp/
添加用户名文件
单行为用户名,双行为密码,例如
#vi userpass
xuchen
12345
然后把文本转换成db4
# db_load -T -t hash -f userpass vsftpd_login.db
# chmod 600 vsftpd_login.db
这样配置就完成了
启动vsftpd /etc/vsftp/vsftpd.conf &就可以了
如果要自动启动就 vi /etc/rc.local
加入vsftpd /etc/vsftp/vsftpd.conf &就可以了
每台服务器的状况都不一样
本文只作为一个大致参考的文章
我也没有太认真的写,但是基本思路及做法肯定都是没问题的。有什么问题可以留言 我会帮你解决。











