Linux 版 (精华区)

发信人: Gamble_Tan@bbs.ustc.edu.cn (岫云), 信区: Linux
标  题: [Tips]如何提高Redhat ftp site的系统安全性.
发信站: 中国科大BBS站 (Fri Aug 14 04:38:46 1998)
转信站: Lilac!ustcnews!ustcbbs

ftp的RPM软件包为你做了大多数事情,但这里有一些是你必须自己做的.
1.为了ls命令能打印出正确的用户名和组名.你可以copy /etc/passwd 和/etc/group文件到/home/ftp/etc下
  但为了安全的考虑,你应当删去passwd文件中encrypted passwd,并用"*"代替.
sed -e 's/:[^:]*:/:*:/' /etc/passwd >/home/ftp/etc/passwd       
  在Redhat下group文件没有密码可以直接cp.
cp /etc/group /home/ftp/etc/group
2.缺省的ftp RPM包会在/home/ftp/bin和/home/ftp/lib下放一些可能永远也用不到的文件.考虑到安全性应当删除.
       cd /home/ftp/bin
       rm cpio sh zcat
       cd ../etc
       rm ld.so.cache
       cd ../lib
       rm ld.so* libtermcap*
3.应该改变一下文件和目录的属性来提高安全性.

       chmod 111 /home/ftp/bin/* /home/ftp/bin /home/ftp/etc /home/ftp/lib
       chmod 444 /home/ftp/etc/*
       chmod 555 /home/ftp /home/ftp/lib/*
达到

       bin:
       total 164
       ---x--x--x   1 root     root        14776 Oct 31 09:54 compress
       ---x--x--x   1 root     root        45277 Oct 29 21:59 gzip
       ---x--x--x   1 root     root        22977 Oct 29 20:07 ls
       ---x--x--x   1 root     root        77873 Oct 25 17:49 tar

       etc:
       total 2
       -r--r--r--   1 root     root          495 Mar 20 19:46 group
       -r--r--r--   1 root     root          921 Mar 20 19:45 passwd

       lib:
       total 702
       -r-xr-xr-x   1 root     root        20994 Oct 30 18:58 ld-linux.so.1
       -r-xr-xr-x   1 root     root        20994 Oct 30 18:58
       ld-linux.so.1.7.5
       lrwxrwxrwx   1 root     root           13 Mar 20 19:43 libc.so.5 ->
       libc.so.5.0.9
       -r-xr-xr-x   1 root     root       669157 Oct 30 19:53 libc.so.5.0.9

 
4.现在建立你的pub目录,为了安全的考虑,应该保证pub下的任何目录和文件对任何人都不可写.
       mkdir /home/ftp/pub
       chmod 555 /home/ftp/pub
       chmod 444 (name-of-file)
       chmod 555 (name-of-directory)

5.如果不是绝对必要,请不要建立incoming目录.如果非要如此的话. 
       mkdir /home/ftp/incoming
       chmod 333 incoming
这里mode 333意味着用户只能进入incoming目录,并且上载文件,但没有list的权限.

6.最后,确保你的/home/ftp下的所有文件,目录对任何人都不可写.(except incoming,
如果你确实需要的话.)
       chmod -R a-w /home/ftp

(请man ftpaccess for more information)
 

--
※ 来源: 中国科大BBS站 [bbs.ustc.edu.cn]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.512毫秒