登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

我行我素

 
 
 

日志

 
 

前进在Fedora 5——06  

2006-05-30 01:20:30|  分类: 郁闷自己 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

vsftpd的配置:


参考资料:
http://www.linuxsir.org/main/?q=node/152





      运行vsftpd很简单,键入vsftpd&就可以了。之后可以用pgrep vsftpd查看运行了没有:
[root@loacahost bin]# pgrep vsftpd
2707

      如果要关闭vsftpd,使用命令pkill vsftpd就可以了。之后可以再用pgrep vsftpd来确认是否关闭。

关于虚拟用户的设置,参考linuxsir的这个文档:http://www.linuxsir.org/bbs/archive/index.php/t-43449.html



(1)生成虚拟用户的数据库
      假设我要添加两个用户,用户名分别是comic和photo,而密码也分别是comic和tour,先生成一个logins.txt:
[root@localhost bin]# vi /root/logins.txt
comic
comic
tour
tour

[root@localhost bin]# db41_load -T -t hash -f /root/logins.txt /etc/vsftpd/vsftpd_login.db
[root@localhost bin]# chmod 600 /etc/vsftpd/vsftpd_login.db



(2)生成使用以上数据库的PAM文件
[root@localhost bin]# vi /etc/pam.d/vsftpd
#%PAM-1.0
#auth       required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
#auth       required pam_shells.so
#auth       include system-auth
#account    include system-auth
#session    include system-auth
#session    required     pam_loginuid.so
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 bin]# cp /etc/pam.d/vsftpd /etc/pam.d/ftp



(3)建立虚拟用户目录
[root@localhost bin]# mkdir /var/ftp/comic
[root@localhost bin]# mkdir /var/ftp/tour
[root@localhost bin]# useradd -d /var/ftp/comic comic
[root@localhost bin]# ls -ld /var/ftp/comic
[root@localhost bin]# useradd -d /var/ftp/tour tour
[root@localhost bin]# ls -ld /var/ftp/tour
这样就将comic和tour两个虚拟用户与各自的目录建立起联系了。



(4)修改vsftpd.conf配置文件
以下是我目前的vsftpd.conf配置文件的内容:
# Example config file /etc/vsftpd/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

pam_service_name=vsftpd
userlist_enable=YES
#enable for standalone mode
listen=YES
tcp_wrappers=YES
listen_port=8021
chroot_local_user=YES
#guset_enable=YES
#guset_username=virtual

pasv_min_port=30000
pasv_max_port=30999


(5)配置开机运行vsftpd
      如果要开机就运行vsftpd的话,非常简单,在服务里面启动就行了。但我的FTP是共享我的XP的分区的,因此必须在开机的时候绑定相关的分区和/var/ftp/下相应的目录,所以必须修改bashrc文件,加入下述命令:
mount --bind -o codepage=936,iocharset=cp936 /mnt/g_fat_lyf/comic /var/ftp/comic
mount --bind -o codepage=936,iocharset=cp936 /mnt/g_fat_lyf/tour /var/ftp/tour

(6)尚待解决的后续问题:
1,对不同用户的权限限制问题,例如上传下载权限和限速限制登录连接数的限制。我参照了linuxsir里的相关描述来修改, 但尚未成功;
2,中文显示的问题。发现不管Xwindow采用的字符编码是utf8,gb2312等等,都无法在windows的ftp客户端正常显示中文,总是得到乱码,google了很多文章都没找到解决办法。


 

 

2006-04-28 22:14:09

  评论这张
 
阅读(193)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018