您的位置:首页 > 编程语言 > PHP开发

vsftpd简单安装

2009-03-12 13:46 736 查看
1、查看ftp服务是否安装。
2、启动服务,ntsysv 选中 vsftpd服务
3、编辑 /etc/vsftpd/vsftpd.conf
修改参数:
anonymous_enable = no
Connect_form_port_20=yes
Pam_service_name=vsftpd
Listen=yes
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Write_enable=yes
Local_enable=yes
Chroot_list_enable=yes
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
4、添加用户
useradd 用户名
passwd 用户名
5、建立存储文件路径
Mkdir /var/ftp/
6、改变文件所有者。
Chown –R 用户名:用户名 /var/ftp/
7、建立受限清单
Touch /etc/vsftpd/vsftpd.chroot_list
Vi /etc/vsftpd/vsftpd.chroot_list
把用户名加入其中。
8、重启ftp服务 /etc/init.d/vsftpd restart.
9、试试吧,应该可以了。不行的话留言。
注:我用的是Linux as4 。软件包全部安装。

/usr/sbin/vsftpd ---- VSFTPD的主程序
  /etc/rc.d/init.d/vsftpd ---- 启动脚本
  /etc/vsftpd/vsftpd.conf ---- 主配置文件
  /etc/pam.d/vsftpd ---- PAM认证文件
  /etc/vsftpd.ftpusers ---- 禁止使用VSFTPD的用户列表文件
  /etc/vsftpd.user_list ---- 禁止或允许使用VSFTPD的用户列表文件
  /var/ftp ---- 匿名用户主目录
  /var/ftp/pub
  ---- 匿名用户的下载目录
  1、打开vsFTPd服务器,当然先要安装,这里就不说了。
  # ntsysv
  把vsftpd服务器打开,也就是在运行 ntsysv命令后,把vsftpd服务选中。
  [*] vsftpd
  或运行应用程序/usr/bin/system-config-services,把vsftpd选中,或G菜单==系统设置==服务器设置==服务
  2、运行/etc/init.d/vsftpd start
  # /etc/init.d/vsftpd start
  # /etc/init.d/vsftpd restart(重启vsftpd)
  3、编辑vsftpd.conf
  布尔选项
  allow_anon_ssl=NO(是否使用SSL连接,如果使用匿名用户将允许使用SSL登陆,默认:NO)
  anon_mkdir_write_enable=YES(允许建立相应的目录,默认:NO)
  anon_other_write_enable=yes (匿名帐号可以有删除的权限,默认:NO)
  anon_upload_enable=YES(开放上传权限,默认:NO)
  anon_world_readable_only=YES (放开匿名用户浏览权限,默认:YES)
  anonymous_enable=YES (允许匿名访问,默认:YES)
  ascii_upload_enable=YES(控制是否允许使用ASCⅡ模式上传文件,YES允许,NO不允许,默认:NO)
  ascii_download_enable=YES(控制是否允许使用ASCⅡ模式下载文件,YES允许,NO不允许,默认:NO)
  async_abor_enable=YES(开启支持早期FTP客户端“async ABOR"命令的能力,默认:NO)
  background (默认:NO)
  When enabled, and vsftpd is started in "listen" mode, vsftpd will background the listener process. i.e. control will immediately be returned to the shell which launched vsftpd.
  Default: NO
  check_shell=YES(此选项仅对不使用PAM方式的VSFTPD生效,当此选项关闭后,当本地用户登录时,VSFTPD不会检查/etc/shells文件以寻找一个有效的用户shell,默认:YES)
  chmod_enable=YES(是否使用CHMOD命令,默认:YES)
  chown_uploads=NO(是否激活匿名用户上传文件的权限,默认:NO)
  chroot_list_enable=YES(锁定某些用户在自家目录中,即当这些用户登录后,不可以转到系统的其他目录,只能在自家目录下,具体的用户在chroot_list_file参数所指定的文件中列出,默认:NO)
  chroot_local_users =yes(将本地用户锁定在自家目录中,当此项被激活时,chroot_list_enable和chroot_local_users参数的作用将发生变化,chroot_list_file所指定文件中的用户将不被锁定在自家目录,本参数被激活后,可能带来安全上的冲突,特别是当用户拥有上传. shell访问等权限时,因此,只有在确实了解的情况下,才可以打开此参数,默认:NO)
  connect_from_port_20=YES(是否确信端口传输来自20(ftp-data),默认:NO,但配置文件依然使此功能可用)
  deny_email_enable =yes(当值为YES时,拒绝使用banned_email_file参数指定文件中所列出的e-mail地址进行登录的匿名用户,即当匿名用户使用 banned_email_file文件中所列出的e-mail进行登录时,被拒绝,显然,这对于阻击某些Dos***有效,当此参数生效时,需追加 banned_email_file参数,默认:NO)
  dirlist_enable=YES(所有的目录list命令将会提供被否认的许可,默认:YES)
  dirmessage_enable=NO(切换目录时,显示目录下.message的内容,默认:NO)
  download_enable=YES(所有的下载请求将会提供被否认的许可,默认:YES)
  dual_log_enable=NO(激活双日志模式,地址为 /var/log/xferlog和/var/log/vsftpd.log,前者为wu-ftpd日志类型,后者为vsftpd日志类型,默认:NO)
  force_dot_files
  If activated, files and directories starting with . will be shown in directory listings even if the "a" flag was not used by the client. This override excludes the "." and ".." entries.
  Default: NO
  force_local_data_ssl
  Only applies if ssl_enable is activated. If activated, all non-anonymous logins are forced to use a secure SSL connection in order to send and receive data on data connections.
  Default: YES
  force_local_logins_ssl
  Only applies if ssl_enable is activated. If activated, all non-anonymous logins are forced to use a secure SSL connection in order to send the password.
  Default: YES
  guest_enable=YES(若是启动这项功能,所有的非匿名登入者都视为guest,默认:NO)
  hide_ids=NO(是否隐藏文件的所有者和组信息,YES,当用户使用"ls -al"之类的指令时,在目录列表中所有文件的拥有者和组信息都显示为ftp,默认:NO)
  listen=YES(当参数为NO时,以Xinetd模式运行,当参数为YES时,以单独模式运行,建议设为YES,默认:NO)
  listen_ipv6=NO(是否使用IPv6,默认:NO)
  local_enable=YES(是否允许本地用户登录,默认:NO)
  log_ftp_protocol=NO(当此选项激活后,所有的FTP请求和响应都被记录到日志中,提供此选项时,xferlog_std_format不能被激活,这个选项有助于调试,默认:NO)
  ls_recurse_enable =NO(是否使用"ls -R"命令,建议不使用,大量消耗服务器资源,默认:NO)
  no_anon_password=NO(控制匿名用户登入时是否需要密码,YES不需要,NO需要,默认:NO)
  no_log_lock
  When enabled, this prevents vsftpd from taking a file lock when writing to log files. This option should generally not be enabled. It exists to workaround operating system bugs such as the Solaris / Veritas filesystem combination which has been observed to sometimes exhibit hangs trying to lock log files.
  Default: NO
  one_process_model
  If you have a Linux 2.4 kernel, it is possible to use a different security model which only uses one process per connection. It is a less pure security model, but gains you performance. You really don't want to enable this unless you know what you are doing, and your site supports huge numbers of simultaneously connected users.
  Default: NO
  passwd_chroot_enable=NO(当此选项激活时,与chroot_local_user选项配合,chroot()容器的位置可以在每个用户的基础上指定,每个用户的容器来源于/etc/passwd中每个用户的自家目录字段,默认:NO)
  pasv_enable=YES (服务器端用被动模式,PASV模式,默认:YES)
  pasv_promiscuous=NO(此选项激活时,将关闭PASV模式的安全检查,该检查确保数据连接和控制连接是来自同一个IP地址,小心打开此选项,此选项唯一合理的用法是存在于由安全隧道方案构成的组织中,默认:NO)
  port_enable=YES(如果你要在数据连接时取消PORT模式时,设此选项为NO,默认:YES)
  port_promiscuous=NO(设为YES时,取消PORT安全检查,该检查确保外出的数据只能连接到客户端上,小心打开此选项,默认:NO)
  run_as_launching_user=NO( ,默认:NO)
  Set to YES if you want vsftpd to run as the user which launched vsftpd. This is useful where root access is not available. MASSIVE WARNING! Do NOT enable this option unless you totally know what you are doing, as naive use of this option can create massive security problems. Specifically, vsftpd does not / cannot use chroot technology to restrict file access when this option is set (even if launched by root). A poor substitute could be to use a deny_file setting such as {/*,*..*}, but the reliability of this cannot compare to chroot, and should not be relied on. If using this option, many restrictions on other options apply. For example, options requiring privilege such as non-anonymous logins, upload ownership changing, connecting from port 20 and listen ports less than 1024 are not expected to work. Other options may be impacted.
  Default: NO
   secure_email_list_enable =NO(如果你想建立一个只有指定的电子邮件地址才能作为匿名登录密码的列表,设为YES,这个在不需要创建虚拟用户的条件下作为一个低安全性的访问控制来说很有用,如果允许的话,只有在email_password_file中指定的电子邮件地址密码才能登录,文件的格式是一行一个密码,默认的文件名是 /etc/vsftpd.email_passwords,默认:NO)
  session_support=NO(这个控制 vsftpd是否为登录保持会话,如果vsftpd保持会话,它将会试图和升级utmp和wtmp,它还会打开一个PAM会话如果使用PAM来认证的话, 只有在退出时才会关闭,如果你不需要保持会话的话,你可能会希望禁止这个选项,或者你希望vsftpd占用更少的资源,注意--utmp和wtmp只支持有PAM的情况,默认:NO)
  setproctitle_enable=NO(YES,VSFTPD将在系统进程列表中显示每个会话 (session)的状态,进程报告将显示每个vsftpd会话在做什么,出于安全的目的.可关闭选项,NO,进程报告只显示一个vsftpd进程在运行,默认:NO)
  ssl_enable
  If enabled, and vsftpd was compiled against OpenSSL, vsftpd will support secure connections via SSL. This applies to the control connection (including login) and also data connections. You'll need a client with SSL support too. NOTE!! Beware enabling this option. Only enable it if you need it. vsftpd can make no guarantees about the security of the OpenSSL libraries. By enabling this option, you are declaring that you trust the security of your installed OpenSSL library.
  Default: NO
  ssl_sslv2
  Only applies if ssl_enable is activated. If enabled, this option will permit SSL v2 protocol connections. TLS v1 connections are preferred.
  Default: NO
  ssl_sslv3
  Only applies if ssl_enable is activated. If enabled, this option will permit SSL v3 protocol connections. TLS v1 connections are preferred.
  Default: NO
  ssl_tlsv1
  Only applies if ssl_enable is activated. If enabled, this option will permit TLS v1 protocol connections. TLS v1 connections are preferred.
  Default: YES
  syslog_enable=NO(如果允许,任何本来应该输入出到/var/log/vsftpd/vsftpd.log的log输入出将会输入到系统log,在FTPD下记录这个,默认:NO)
  tcp_wrappers=NO(在VSFTPD中使用TCP_Wrappers远程访问控制机制,默认:NO)
  text_userdb_names=NO(当使用者登入后使用指令时,目录列表的用户和组信息域,默认是出现拥有者的UID,而不是该档案拥有者的名称,若是希望出现拥有者的名称,则将此功能开启,默认:NO)
  tilde_user_enable
  If enabled, vsftpd will try and resolve pathnames such as ~chris/pics, i.e. a tilde followed by a username. Note that vsftpd will always resolve the pathnames ~ and ~/something (in this case the ~ resolves to the initial login directory). Note that ~user paths will only resolve if the file /etc/passwd may be found within the _current_ chroot() jail.
  Default: NO
  use_localtime=NO(如果被允许,vsftpd将会在目录列表中同时显示你本地时区的时间,默认是显示GMT,这个选项也影响到用MDTM FTP 命令返回的时间,默认:NO)
  use_sendfile=YES(一个内部设置用于测试在你的平台上使用sendfile()系统调用的相关的好处,默认:YES)
  userlist_deny =YES(决定禁止还是只允许由userlist_file指定文件中的用户登录FTP服务器,此选项在userlist_enable 选项启动后才生效,YES,禁止文件中的用户登录,同时也不向这些用户发出输入口令的提示,NO,只允许在文件中的用户登录FTP服务器,默认:YES)
  userlist_enable=NO(在userlist_file文件中的用户不可以访问,默认:NO)
  virtual_use_local_privs=NO(当该参数激活时虚拟用户使用与本地用户相同的权限,当此参数关闭时,虚拟用户使用与匿名用户相同的权限,默认:NO)
  write_enable=YES(控制是否允许使用任何可以修改文件系统的FTP的指令,比如STOR.DELE.RNFR.RNTO.MKD.RMD.APPE以及SITE,默认:NO,不过自带的简单配置文件中打开了该选项)
  xferlog_enable=YES(激活上传和下传的日志,地址/var/log/vsftpd.log,默认:NO,但自带的配置文件中激活了此选项)
  xferlog_std_format=NO(控制日志文件是否使用xferlog的标准格式,如同wu-ftpd一样,使用xferlog格式,可以重新使用已经存在的传输统计生成器,默认的日志格式更为可读性,默认:NO,但自带的配置文件中激活了此选项)
  数字选择
  accept_timeout=60(接受建立联机的超时设定,单位为秒,默认:60)
  anon_max_rate=30000(匿名用户传输率30K,单位为Bytes/s,默认:0 不限)
  anon_umask=077(匿名登入者新增档案时的umask数值,默认值为077)
  data_connection_timeout=300(空闲的数据连接的超时时间,单位为秒,默认:300)
  connect_timeout=60(响应PORT方式的数据联机的超时设定,单位为秒,默认:60,以上两个选项针对客户端的,将使客户端空闲1分钟后自动中断连接,并在中断1分钟后自动激活连接)
  file_open_mode=0666(上传档案的权限,与chmod 所使用的数值相同,如果希望上传的文件可以执行,设此值为0777,默认:0666)
  ftp_data_port=20(FTP数据连接端口,需connect_from_port_20激活,默认:20)
  idle_session_timeout=300(空闲用户会话的超时时间,若是超出这时间没有数据的传送或是指令的输入,则会强迫断线,单位为秒,默认:300)
  Listen_port=21(指定FTP服务器监听的端口号,此选项在standalone模式下生效,默认:21)
  Local_max_rate=50000(本地用户传输率50K,默认:0不限)
  local_umask=077(FTP上本地的文件权限,如果你指定的是一个八进制数,请在前面加上一个0,否则认为是十进制数,默认:077)
  max_clients=200(FTP的最大连接数,默认:0不限)
  max_per_ip=4(每IP的最大连接数,默认:0不限)
  pasv_min_port=50000
  pasv_max_port=60000(设定在PASV模式下,建立数据传输所可以使用port范围的下界和上界,0 表示任意,把端口范围设在比较高的一段范围内50000—60000之间,默认:0)
  trans_chunk_size=0(你可能不想改变它,如果是带宽限制,试着设为8192等,默认: 0 ,让vsftpd选择一个比较好的)
  字符选择
  anon_root=/vra/ftp (匿名的目录,默认:none)
  banned_email_file=/etc/vsftpd.banned_emails(是否允许禁止匿名用户使用某些邮件地址,如果是输入禁止的邮件地址的路径和文件名,默认:/etc/vsftpd.banned_emails)
  banner_file=/var/vsftpd_banner_file (用户连接后欢迎信息使用的是此文件中的相关信息,默认:none)
  chown_username=root(是否修改匿名用户所上传文件的所有权,YES,匿名用户所上传的文件的所有权将改为另外一个不同的用户所有,用户由chown_username参数指定,默认:root)
  chroot_list_file=/etc/vsftpd.chroot_list(指出被锁定在自家目录中的用户的列表文件。文件格式为一行一用户,默认:/etc/vsftpd.chroot_list)
  cmds_allowed=PASV,RETR,QUIT(允许用户使用命令列表,中间用英文逗号隔开,默认:none)
  deny_file={*.mp3,*.mov,.private}(拒绝访问文件类型,默认:none)
  dsa_cert_file=none((使用SSL连接时DRSA证书的位置,默认:none)
  email_password_file=/etc/vsftpd.email_passwords (vsftpd.email_passwords文件中指定的电子邮件地址密码才能登录默认:/etc/vsftpd.email_passwords)
  ftp_username=ftp(匿名用户所使用的系统用户名,默认下,此参数在配置文件中不出现,默认:ftp)
  ftpd_banner=Welcome to Zxs FTP service.(定制欢迎信息,默认:none)
  guest_username=ftp (当guest_enable激活时,定义VSFTPD的guest用户在系统中的用户名,默认:ftp)
  hide_file={*.mp3,.hidden,hide*,h?} (隐藏文件类型,默认:none)
  listen_address =192.168.0.1(此参数在VSFTPD使用单独(standalone)模式下有效,此参数定义了在主机的哪个IP地址上监听FTP请求,即在哪个IP地址上提供FTP服务,对于只有一个IP地址的主机,不需要使用此参数,对于多址主机,不设置此参数,则监听所有IP地址,默认:none)
  listen_address6=none (同上,不过IP为IPV6格式,默认:none)
  local_root=none(定义所有本地用户的根目录,当本地用户登入时,将被更换到此目录下,默认:none)
  message_file=.message(设置访问一个目录时获得的目录信息文件的文件名,默认:.message)
  nopriv_user=nobody(指定一个安全用户账,让FTP服务器用作完全隔离和没有特权的独立用户,这是vsftpd系统推荐选项,默认:nobody)
  pam_service_name=ftp(FTP服务器名,默认:ftp )
  pasv_address=none (此选项为一个数字IP地址,作为PASV命令的响应,即地址是从呼入的连接套接字(incoming connectd socket)中获取,默认为none)
  rsa_cert_file=/usr/share/ssl/certs/vsftpd.pem(使用SSL连接时RSA证书的位置,默认:/usr/share/ssl/certs/vsftpd.pem)
  secure_chroot_dir =/usr/share/empty(这选项指向一个空目录,并且ftp用户对此目录无写权限。当vsftpd不需要访问文件系统时,这个目录将被作为一个安全的容器,用户将被限制在此目录中。默认目录为/usr/share/empty)
  ssl_ciphers (SSL安装密码,默认:DES-CBC3-SHA )
  user_config_dir =none(定义用户个人配置文件所在的目录,用户的个人配置文件为该目录下的同名文件,个人配置文件的格式与vsftpd.conf格式相同,例如定义 user_config_dir=/etc/vsftpd/userconf,并且主机上有用户zxs,zxs1,那我们可以在 user_config_dir的目录新增名为zxs,zxs1的两个文件。当用户zxs1登入时,VSFTPD则会读取user_config_dir 下lisi这个文件中的设定值,应用于用户zxs1i,默认:none)
  user_sub_token=none (默认:none )
  This option is useful is conjunction with virtual users. It is used to automatically generate a home directory for each virtual user, based on a template. For example, if the home directory of the real user specified via guest_username is /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user fred logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/fred. This option also takes affect if local_root contains user_sub_token.
  Default: (none)
  Userlist_file=/指定的路径/vsftpd.user_list(指出userlist_enable选项生效后,被读取的包含用户列表的文件,默认: /var/log/vsftpd.log )
  vsftpd_log_file
  This option is the name of the file to which we write the vsftpd style log file. This log is only written if the option xferlog_enable is set, and xferlog_std_format is NOT set. Alternatively, it is written if you have set the option dual_log_enable. One further complication - if you have set syslog_enable, then this file is not written and output is sent to the system log instead
  xferlog_file=/var/log/vsftpd.log(日志存放地址,默认: /var/log/vsftpd.log)
  如要建立虚拟目录,请用#mount --bind [原有的目录] [新目录]命令
  如/home/zxs 映射为ftp://localhost/zxs
  查看谁登陆了FTP,并杀死它的进程
  ps –xf |grep ftp
  kill 进程号
  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 休闲 vsftpd