用Linux架设FTP服务器(6)
2009-05-13 00:54:16来源:未知 阅读 ()
保证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-qanonftp.
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/*/etcno
upload/home/ftp/*/devno
upload/home/ftp/*/binno(requireonlyifyouarenotusingthe“--enable-ls”option)
upload/home/ftp/*/libno(requireonlyifyouarenotusingthe“--enable-ls”option)
noretrieve命令
最好禁止某些用户从“/home/ftp”目录下的某些子目录中下载文件,可以用“noretrieve”命令在“/etc/ftpaccess”文件中设置。
noretrieve/home/ftp/etc
noretrieve/home/ftp/dev
noretrieve/home/ftp/bin(requireonlyifyouarenotusingthe“--enable-ls”option)
noretrieve/home/ftp/lib(requireonlyifyouarenotusingthe“--enable-ls”option)
“.notar”文件
无论是否允许即时的目录打包(on-the-flytar),都必须保证用户不能打包(tar)禁止上载的目录。在“/home/ftp”目录的每个子目录中都创建“.notar”文件。
[root@deep]#touch/home/ftp/.notar
[root@deep]#chmod0/home/ftp/.notar
[root@deep]#touch/home/ftp/etc/.notar
[root@deep]#chmod0/home/ftp/etc/.notar
[root@deep]#touch/home/ftp/dev/.notar
[root@deep]#chmod0/home/ftp/dev/.notar
[root@deep]#touch/home/ftp/bin/.notar(requireonlyifyouarenotusingthe“--enable-ls”option)
[root@deep]#chmod0/home/ftp/bin/.notar(requireonlyifyouarenotusingthe“--enable-ls”option)
[root@deep]#touch/home/ftp/lib/.notar(requireonlyifyouarenotusingthe“--enable-ls”option)
[root@deep]#chmod0/home/ftp/lib/.notar(requireonlyifyouarenotusingthe“--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
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- 文件压缩和打包 2020-06-11
- 安装Zabbix5.0 2020-06-10
- 厉害了!知道这样重命名文件都是大佬级别! 2020-06-09
- 一个骚命令防止你的文件被误删除! 2020-06-08
- linux各级目录 2020-06-08
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash