北京 上海 广州 深圳 >>
网站建设
我们的优势
我们的报价
联系我们
首 页 关于我们 建站套餐 网站优化 网站推广 解决方案 成功案例 客服中心 建站问题 推广知识 建站知识  
网站建设
  网站建设套餐
  网站建设流程
  功能模块介绍
  网页设计报价
  网站改版设计
  网站售后服务
 
最新客户
   
网站推广
推广知识
 
· 浅谈造成网站关键字排名
· 浅谈最近百度调整对网站
· 分析:站内锚文本链接使
· 细节成就权重 权重决定
· 根据百度有效反链数据
· 详解SEO策略制定中的
· 关键词排名优化之挖掘长
 
建站技术知识
 
 
用Linux架设FTP服务器(下)
message   “message”设置当用户登录或转到一个目录的时候会收到什么消息。可以设定多个消息。命令的格式为:  message <path> <when><path>表示需要显示的文件的完整路径名,<when>和“readme”中的<when>意思一样。  还需要注意的是消息文件的路径名也是相对于匿名ftp目录的。  例如:  message /home/ftp/.welcome.msg LOGIN  compress、tar、chmod、delete、overwrite、rename如果这些都不设置,那么就使用默认值,也就是对所有人都是“yes”。下面例子中的设置的意思是给guest组chmod、delete、overwrite和rename文件的权力,所有人都可以使用compress和tar。  例如:  compress yes all  tar yes all  chmod yes guest  delete yes guest  overwrite yes guest  rename yes guest  log commands  因为安全上的原因需要记录用户使用的每一个命令。“log commands”的格式是:  log commands <typelist>  <typelist>是用逗号隔开的字串,表示哪些用户的命令需要记录下来,字串的取值可以是:anonymous、guest或real。  例如:要记录real和guest用户的每一个命令,可以这么表示:  log commands real,guest  这些记录都保存在“/var/log/message”文件中。  log transfers  因为安全文件需要把文件的传输都记录下来。“log transfers”的格式是:  log transfers <typelist> <directions>  <typelist>是用逗号隔开的字串,表示哪些用户的命令需要记录下来,字串的取值可以是:anonymous、guest或real。<direction>也是用逗号隔开的字串,设置需要记录的文件传输的方向,可以选择的两个传输方向是“inbound”(向内)和“outbound”(向外)。例如,用下面表示记录所有real和guest用户的“inbound”和“outbound”方向的文件传输:   log transfers real,guest inbound,outbound  这些记录保存在“/var/log/xferlog”文件中。  guestgroup  这个命令用来设置guest组,每一行只能有一个成员。  例如:  guestgroup ftpadmin  guestgroup webmaster  log security  用来设置记录real、guest或anonymous用户违反安全规则的行为。  log security <typelist>  <typelist>是用逗号隔开的字串,字串的取值可以是:anonymous、guest或real。“real”表示真正在ftp服务器上有帐号的用户,“anonymous”表示匿名用户,“guest”表示guest用户。  例如:  log security real,guest  restricted-uid、restricted-gid、guest-root  这些用来设置是否允许real和guest用户访问家目录之外的目录。格式为:  guest-root <root-dir>  restricted-uid <uid-range>  restricted-gid <gid-range>  例如:  guest-root /home/ftp ftpadmin webmaster  restricted-uid ftpadmin webmaster  restricted-gid adminftp webmaster  <root-dir>设置chroot环境的用户路径。在一行里可以有多个uid地范围。如果为用户设置了guest-root,那么该用户的家目录就在“<root-dir>/etc/passwd”文件中设定,而“/etc/passwd”文件中的设定是无效的。当“ftpadmin”和“webmaster”被改变了根目录(chrooted)到“/home/ftp”目录下,他们就被限制在各自的家目录下而不能访问别人的文件。  greeting  设置用户登录时候的欢迎信息。格式为:  greeting full|brief|terse  “greeting full”是默认的设置显示主机名和ftp daemon地版本,“greeting brief”显示主机名,“greeting terse”简单地显示“FTP server ready”。  例如:  greeting terse  keepalive <yes|no>  设置socket的TCP SO_KEEPALIVE参数。这样在必要的时候可以断开网络连接。“yes”有效,“no”无效。最好设成“yes”:  Keepalive yes配置“/etc/ftphosts”文件  “/etc/ftphosts”文件为每一个用户建立规则,指定允许用户从某个主机登录ftp服务器,或者不允许用户从某个主机登录ftp服务器。   创建“ftphosts”文件(touch /etc/ftphosts),加入下面这几行:  # Example host access file  #  # Everything after a ‘#‘ is treated as comment,  # empty lines are ignored  allow ftpadmin 208.164.186.1 208.164.186.2 208.164.186.4  把文件的权限改为600:  [root@deep]# chmod 600 /etc/ftphosts  每一行可能是:  allow <username> <addrglob>  或  deny <username> <addrglob>  “allow”允许用户用<username>用户名,从<addrglob>地址访问ftp服务器。<addrglob>可以包含多个地址。  “deny”禁止用户名为<username>的用户,从<addrglob>地址访问ftp服务器。<addrglob>可以包含多个地址。  配置“/etc/ftpusers”文件  “/etc/ftpusers”文件设置哪些用户不允许连接到ftp服务器。  创建“ftpusers”文件(touch /etc/ftpusers),加入下面这几行:  root  bin  daemon  adm  lp  sync  shutdown  halt  mail  news  uucp  operator  games  nobody  把文件的权限设成600:  [root@deep]# chmod 600 /etc/ftpusers  配置“/etc/ftpconversions”文件  “/etc/ftpconversions”是用来控制当传输文件的时候是否进行压缩。  创建“ftpconversions”文件(touch /etc/ftpconversions),在文件中加入:  :.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS  : : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS  :.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP  : : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP  : : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR  : : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS  : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP  : : :.crc:/bin/cksum %s:T_REG::CKSUM  : : :.md5:/bin/md5sum %s:T_REG::MD5SUM  把文件的属性改为600:  [root@deep]# chmod 600 /etc/ftpconversions  配置“/etc/pam.d/ftp”文件  配置“/etc/pam.d/ftp”文件使其支持PAM安全验证。创建“ftp”文件(touch /etc/pam.d/ftp)并加入:   #%PAM-1.0  auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed  auth required /lib/security/pam_pwdb.so shadow nullok  auth required /lib/security/pam_shells.so  account required /lib/security/pam_pwdb.so  session required /lib/security/pam_pwdb.so  配置“/etc/logrotate.d/ftpd”文件  配置“/etc/logrotate.d/ftpd”文件使得日志文件每周自动循环更新。  创建“ftpd”文件(touch /etc/logrorate.d/ftpd)并加入:  /var/log/xferlog {  # ftpd doesn‘t handle SIGHUP properly  nocompress  }  配置ftp使其使用inetd超级服务器(用于实现tcp-wrappers)  tcp-wrappers用来启动和中止ftpd服务。当inetd执行的时候,它会从默认为“/etc/inetd.conf”的配置文件读入配置信息。配置文件中每一行中的项用TAB或空格隔开。  编辑inetd.conf文件(vi /etc/inetd.conf),加入并验证是否存在下面这一行: ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a  注意:更新完“inetd.conf”文件之后要发给inetd一个SIGNUP信号,运行下面的命令:  [root@deep /root]# killall -HUP inetd  编辑“hosts.allow”文件(vi /etc/hosts.allow)加入这一行:  in.ftpd: 192.168.1.4 win.openarch.com  这表示IP地址为“192.168.1.4”并且主机名为“win.openarch.com”的计算机允许访问ftp服务器。  FTP管理工具  ftpwho  ftpwho显示当前连接到ftp服务器上的所有用户。这个命令菜单输出类似“/bin/ps”的输出,其格式为:  <pid> <time> <tty> <connection details>  其中<pid>表示ftp daemon用来处理这次文件传输的进程号,<time>表示用户什么时候连接到ftp服务器上,<tty>总是用问号(?)表示因为是通过ftp而不是telnet连接,<connection details>告诉连接是来自哪里、用户是谁以及用户现在在干什么。  下面是ftpwho输出的一个例子:  [root@deep]# ftpwho  Service class openarch:  5443 ? S 0:00 ftpd: win.openarch.com: admin: IDLE  - 1 users ( 20 maximum)可以看到现在有一个用户登录(最多可以有20个用户同时登录),这个用户的用户名是admin来自win.openarch.com。   ftpcount  ftpcount是ftpwho的简化版,只显示登录到ftp服务器的用户数以及最多允许多少个用户登录。下面是一个例子:  [root@deep]# ftpcount  Service class openarch - 1 users ( 20 maximum)  保证ftp服务器的安全  首先确保已经创建了“/etc/ftpusers”文件,这个文件用来设置不允许哪些用户登录ftp服务器,其中至少要包括:root、bin、daemon、adm、lp、sync、shutdown、halt、mail、news、uucp、operator、games、nobody以及所有Linux发行商在系统中提供的默认帐号。  如果想禁止匿名ftp服务,把ftp用户从password文件中移去,再用下面的命令确定在系统中没有安装anonftp-version.i386.rpm软件包:  [root@deep]# rpm -q anonftp.  upload命令  在默认情况下,WU-FTPD服务器给所有的guest用户上载的权限。当用户登录的时候,被改变根目录(chroot)到“/home/ftp”就不能访问这个目录之外的地方。但是“/home/ftp”目录中的一些地方还是需要保护,不能让用户随便访问。在我们配置的ftp服务器中为“/home/ftp”目录下的“bin”、“etc”、“dev”和“lib”目录。我们不允许用户上载文件到这些目录。所以我们要为这些目录设置访问权限,可以在“/etc/ftpaccess”文件中设置上载权限。在我们的例子中是这样设置的:  upload /home/ftp/* / no  upload /home/ftp/* /etc no  upload /home/ftp/* /dev no  upload /home/ftp/* /bin no (require only if you are not using the “--enable-ls” option)  upload /home/ftp/* /lib no (require only if you are not using the “--enable-ls” option)  noretrieve命令  最好禁止某些用户从“/home/ftp”目录下的某些子目录中下载文件,可以用“noretrieve”命令在“/etc/ftpaccess”文件中设置。  noretrieve /home/ftp/etc  noretrieve /home/ftp/dev  noretrieve /home/ftp/bin (require only if you are not using the “--enable-ls” option)  noretrieve /home/ftp/lib (require only if you are not using the “--enable-ls” option)  “.notar”文件  无论是否允许即时的目录打包(on-the-fly tar),都必须保证用户不能打包(tar)禁止上载的目录。在“/home/ftp”目录的每个子目录中都创建“.notar”文件。  [root@deep]# touch /home/ftp/.notar  [root@deep]# chmod 0 /home/ftp/.notar  [root@deep]# touch /home/ftp/etc/.notar  [root@deep]# chmod 0 /home/ftp/etc/.notar  [root@deep]# touch /home/ftp/dev/.notar  [root@deep]# chmod 0 /home/ftp/dev/.notar  [root@deep]# touch /home/ftp/bin/.notar (require only if you are not using the “--enable-ls” option)  [root@deep]# chmod 0 /home/ftp/bin/.notar (require only if you are not using the “--enable-ls” option)  [root@deep]# touch /home/ftp/lib/.notar (require only if you are not using the “--enable-ls” option)  [root@deep]# chmod 0 /home/ftp/lib/.notar (require only if you are not using the “--enable-ls” option)这些长度为0的“.notar”文件会使一些浏览器和ftp代理(proxy)出现混乱,要解决这个问题必须把它们标识为禁止下载。在“/etc/ftpaccess”文件中加入这一行:   noretrieve .notar  安装到系统中的文件  > /etc/ftphosts  > /etc/ftpusers  > /etc/ftpaccess  > /etc/pam.d/ftp  > /etc/ftpconversions  > /etc/ftpgroups  > /etc/logrotate.d/ftpd  > /usr/bin/ftpcount  > /usr/bin/ftpwho  > /usr/man/man1/ftpcount.1  > /usr/man/man1/ftpwho.1  > /usr/man/man5/ftpaccess.5  > /usr/man/man5/ftphosts.5  > /usr/man/man5/ftpconversions.5  > /usr/man/man5/xferlog.5  > /usr/man/man8/ftpd.8  > /usr/man/man8/ftpshut.8  > /usr/man/man8/ftprestart.8  > /usr/sbin/in.ftpd  > /usr/sbin/ftpshut  > /usr/sbin/ckconfig  > /usr/sbin/ftprestart  > /usr/sbin/xferstats  > /usr/sbin/wu.ftpd  > /usr/sbin/in.wuftpd  > /var/log/xferlog 来源:
 
在线咨询
     
 
QQ咨询
旺旺咨询
 
MSN咨询
  点击开始咨询 点击开始咨询
  点击开始咨询 点击开始咨询
建站服务
       经济型网站设计套餐 ¥2580
       企业型网站设计套餐 ¥3980
       豪华型网站设计套餐 ¥6580
       商城型网站设计套餐 ¥7580
       定制型网站设计套餐 ¥面 谈
       智赢型ABC ¥1580/1980
虚拟主机
       普及型(电信)350元/年
       经济型(电信)650元/年
       普及A型(双线)500元/年
       普及B型(双线)900元/年
       外贸型(国外) 550元/年
       企业型(国外) 1050元/年
我要订购主机>>       
域名注册
     国际顶级域名.com 100元/年
     国际顶级域名.net 100元/年
     国际顶级域名.cc 380元/年
     国际顶级域名.org 180元/年
     中国顶级域名.cn 100元/年
     中国顶级域名.com.cn 100元/年
     中文域名.中国.公司 280元/年
我要注册域>>       
 友情链接:湖南网站建设 广州网站建设 上海网站建设 广州网站建设公司 中山网站制作 网页设计网 网页设计公司 网站制作 网站建设 建网站公司 珠海网站建设 赢在网络
 业务范围: 广州虚拟主机 广州网站设计 广州网页制作 广州网页设计 深圳网站建设 珠海网页设计 中山网页制作 汕头网站设计 番禺网页制作 南海网站建设 肇庆网页制作

联系我们 | 建站套餐 | 网站建设 | 建设知识 | 服务报价 | 解决方案 | 成功案例 点击开始咨询 点击开始咨询
Copyright 2005-2020 win580.com rights reserved 电话:020-87518743 87518740  传真:020-87518740
地址:广州市天河区中山大道西8号(天河商贸大厦)1304室  邮编:510620
E-mail:Win580@126.com