关于vsftpd和smbd配置

这两个服务比较简单其实,如果在配置的时候selinux=disabled,那么就没有什么难度了。

当然如果配的时候smbd_disable_trans=on

ftpd_disable_trans=on 这样也没有什么难度。至于这样做对不对,我也不知道,但是个人觉得吧,

selinux自从开发出来以后,备受关注,各大linux发行版厂商都将selinux加进发行版里。可见selinux的重要性。

而且单单对于redhat而言,从AS4到AS5,他们将selinux的fcontext从13个增加到88个,可能以后还要增加,可见

selinux的重要性。

下面先简单地说一下关于vsftpd和smb的selinux:理解得不是很透,有待以后补充

关于ftp

  1.匿名用户上传:
    anon_upload_enable=YES
    anon_mkdir_write_enable=YES
  selinux设置:
    setsebool -P allow_ftpd_anon_write on
    mkdir /var/ftp/input
    chmod 777 /var/ftp/input
    chcon -t public_content_rw_t /var/ftp/input
    ls -Zd /var/ftp/input

  2.基于系统用户上传:
    setsebool -P ftp_home_dir on
    chroot_list_enable=YES
    chroot_list_file=/etc/vsftpd/chroot_list


关于smb:

匿名用户上传:
    1.# ls -dZ /samba-share/  
         drwxr-xr-x nobody nobody root:object_r:root_t /samba-share/  
      
    2.# chcon -R -t samba_share_t /samba-share/  
      
    3.# ls -dZ /samba-share/  
           drwxr-xr-x nobody nobody root:object_r:samba_share_t /samba-share/      
处理2:
                 1.# ls -dZ /samba-share/  
                          drwxr-xr-x  root root root:object_r:root_t             /samba-share/  
                       2 .# chcon -R -t public_content_rw_t /samba-share/  
                     3.# ls -dZ /samba-share/  
                      drwxr-xr-x  nobody nobody root:object_r:public_content_rw_t /samba-share/  


    
          註:public_content_t(讀)與public_content_rw_t(寫)是所有domain  

共同可以存取的檔案type,後者通常需要打開allow_xxx_anon_write項目的布林值,否則只具備讀的權限而已。      




# getsebool -a | grep allow_smbd_anon_write
allow_smbd_anon_write --> off
•开启这个允许匿名写入。
# setsebool -P allow_smbd_anon_write=1

posted @ 2009-05-08 17:35  冷月X  阅读(640)  评论(0编辑  收藏  举报