Discuz! X 2.0和Ucenter 1.6权限设置

注意:本文最后更新于 2531 天前,有关的内容可能已经发生变化,请参考使用。

升级完网站系统之后,在网站的程序文件夹下这样的权限是极端不靠谱的:

        drwxrwxrwx  20 www   www        1.0K Jun  6 02:27 www/ 

可以先执行以下操作:

        chown -R www:www /www;chmod u-w,u-r,g-w,g-r /www
        find /www -type f -print0 | xargs -0 chmod u-x,g-x,o-x,u-w,g-w
        find /www -type d -print0 | xargs -0 chmod u-r,g-r,u-w,g-w

这样就可以去除掉所有网站文件的执行权限和目录的列表权限,再依照情况去除所有网站目录中不需要写权限文件夹的w权限,在配合nginx的上传目录禁止运行脚本设置,这样即使被人取得webshell也不能造成太大的危害。(即不需要写入的网站文件夹给x权限,需要写入的网站文件夹给wx权限)

附:(将下面文件列表保存为pre,用cat pre | xargs chmod u+w命令批量修改权限,参考:

    find . -type f -print0 | xargs -0 chmod u+r,u-x,g+r,g-x,o-x,u-w,g-w;
    find . -type d -print0 | xargs -0 chmod u-r,g-r,u-w,g-w;cat pre | xargs chmod -R u+w,g+w;

PS:Discuz X2中source文件夹必须有r的权限,否则访问admin.php的时候会出500错误。

Ucenter的目录权限和文件权限设置

    ./data/avatar
    ./data/backup
    ./data/cache
    ./data/logs
    ./data/tmp
    ./data/view

Discuz! X 社区网站目录权限和文件需要写权限的对象


    ./data/avatar
    ./data/imagecache
    ./data/plugindata
    ./data/sysdata
    ./data/request
    ./data/template
    ./data/threadcache
    ./data/attachment
    ./data/usr/uploads/attachment/album
    ./data/usr/uploads/attachment/forum
    ./data/usr/uploads/attachment/group
    ./data/log
    ./data/cache
    ./uc_client/data/cache
    ./uc_server/data/
    ./uc_server/data/cache
    ./uc_server/data/avatar
    ./uc_server/data/backup
    ./uc_server/data/logs
    ./uc_server/data/tmp
    ./uc_server/data/view

记事狗结构图及每个文件功能介绍


    ┣ api 接口目录
    ┃┣ uc.php    
    ┃┣ uc_api_db.php 
    ┣ backup 备份目录
    ┃┣ 
    ┣ cache 缓存目录
    ┃┣ index 首页缓存目录
    ┃┃┣ r_users.cache.php
    ┃┃┣ recommend_topics.cache.php
    ┃┣ misc 杂项缓存目录
    ┃┃┣ role 角色缓存目录
    ┃┃┣ _guestIndex-list_notice.cache.php
    ┃┃┣ admin_statistic.cache.php
    ┃┃┣ data_length.cache.php
    ┃┃┣ .........
    ┃┣ role 角色缓存目录
    ┃┃┣ role_1.cache.php
    ┃┃┣ .........
    ┃┣ role_action 角色动作缓存目录
    ┃┃┣ 
    ┃┣ table 表结构缓存目录
    ┃┃┣ jishigou_member_validate.cache.php 
    ┃┃┣ ........
    ┃┣ tag 标签缓存目录
    ┃┃┣ day7_guanzhu.cache.php
    ┃┃┣ ........
    ┃┣ templates 模板缓存总目录
    ┃┃┣ default 默认模板目录 
    ┣ errorlog 错误日志目录
    ┃┣ 
    ┣ iis_rewrite iis伪静态配置目录
    ┃┣ 
    ┣ images 图片目录
    ┃┣ medal 勋章目录
    ┃┃┣ ...... 
    ┃┣ temp 临时图片目录 
    ┃┃┣ ...... 
    ┃┣ topic 消息图片目录 
    ┃┃┣ ...... 
    ┃┣ video_img 视频图片目录 
    ┃┃┣ ...... 
    ┃┣ weather 天气图片目录
    ┃┃┣ ...... 
    ┣ include 核心引用包含资源库目录
    ┃┣ db 数据库类目录
    ┃┃┣ database.db.php 各种数据库接口库
    ┃┃┣ mysql.db.php mysql数据库库;
    ┃┣ encoding 编码转换目录 
    ┃┃┣ chinese.class.php 汉字编码库
    ┃┃┣ tables 编码表目录
    ┃┣ function 常用函数库目录
    ┃┃┣ app.func.php 应用函数库
    ┃┃┣ area.func.php 地区函数库
    ┃┃┣ global.func.php 全局函数库
    ┃┃┣ imjiqiren.func.php 机器人函数库
    ┃┃┣ imjiqiren_env.func.php 机器人接口库
    ┃┃┣ misc.func.php 杂项函数库
    ┃┃┣ my.func.php  我的验证函数库
    ┃┃┣ order.func.php  排序函数库
    ┃┃┣ qqwb.func.php QQ微博函数库---加密
    ┃┃┣ qqwb_env.func.php QQ微博接口函数库---加密
    ┃┃┣ schedule.func.php 任务调度函数库
    ┃┃┣ sina.func.php 新浪微博函数库
    ┃┃┣ sina_env.func.php  新浪微博接口函数库
    ┃┃┣ sms.func.php 短信函数库
    ┃┃┣ sms_env.func.php 短信接口函数库
    ┃┃┣ zip.func.php zip压缩文件类库
    ┃┣ lib 资源库
    ┃┃┣ cookie.han.php cookie库
    ┃┃┣ form.han.php 表单库
    ┃┃┣ ftp.han.php ftp库
    ┃┃┣ http_client.class.php http client 库
    ┃┃┣ imjiqiren_db.class.php 
    ┃┃┣ io.han.php 磁盘,文件库
    ┃┃┣ mail.han.php 邮件库
    ┃┃┣ member.han.php 用户操作类 用户存在,权限判断
    ┃┃┣ rewrite.han.php 伪静态
    ┃┃┣ servicesJSON.han.php json 类
    ┃┃┣ sms_db.class.php 短信类
    ┃┃┣ smtp.han.php smtp类
    ┃┃┣ template.han.php 模板解析类
    ┃┃┣ thumb.class.php 缩略图类
    ┃┃┣ upload.han.php 上传类
    ┃┃┣ validate.han.php 外部数据验证
    ┃┣ logic 逻辑库 
    ┃┣ qqwb QQ微博库 
    ┃┣ task 任务计划库 
    ┃┣ xwb 新浪微博库 
    ┣ modules 核心模块目录
    ┃┣ admin 后台核心模块目录 
    ┃┃┣ 
    ┃┣ ajax ajax模块目录 
    ┃┃┣ app.mod.php
    ┃┃┣ face.mod.php
    ┃┃┣ master.mod.php
    ┃┃┣ member.mod.php
    ┃┃┣ pm.mod.php
    ┃┃┣ reminded.mod.php
    ┃┃┣ schedule.mod.php
    ┃┃┣ sms.mod.php
    ┃┃┣ topic.mod.php
    ┃┃┣ vote.mod.php
    ┃┣ imjiqiren 机器人模块目录 -- 加密
    ┃┃┣ 
    ┃┣ sms 短信模块目录 -- 加密
    ┃┃┣ 
    ┃┣ blacklist.mod.php 黑名单模块  
    ┃┣ get_password.mod.php 找回密码模块  
    ┃┣ imjiqiren.mod.php 机器人模块---加密  
    ┃┣ login.mod.php 登录模块  
    ┃┣ master.mod.php 主模块  
    ┃┣ member.mod.php 用户模块  
    ┃┣ other.mod.php 杂项模块 
    ┃┣ pm.mod.php 站内短信模块  
    ┃┣ profile.mod.php 个人模块  
    ┃┣ qqwb.mod.php QQ微博接口模块  
    ┃┣ report.mod.php  举报模块 
    ┃┣ search.mod.php 搜索模块  
    ┃┣ settings.mod.php  个人设置模块
    ┃┣ share.mod.php 分享模块  
    ┃┣ show.mod.php  个人资料展示模块
    ┃┣ sms.mod.php  短信模块
    ┃┣ tag.mod.php 标签模块
    ┃┣ theme.mod.php 个人模板设置模块 
    ┃┣ topic.mod.php 话题模块
    ┃┣ url.mod.php 外链跳转模块
    ┃┣ user_tag.mod.php  个人标签模块
    ┃┣ vote.mod.php 投票操作模块 
    ┃┣ xwb.mod.php 新浪微博模块 
    ┣ setting 系统设置参数目录
    ┃┣ ad.php 
    ┃┣ admin_left_menu.php  
    ┃┣ area.php  
    ┃┣ cache.php  
    ┃┣ constants.php  
    ┃┣ credits.php  
    ┃┣ credits_rule.php  
    ┃┣ email_notice.php  
    ┃┣ face.php  
    ┃┣ filter.php  
    ┃┣ ftp.php  
    ┃┣ imjiqiren.php  
    ┃┣ link.php  
    ┃┣ member.php 
    ┃┣ report.php  
    ┃┣ rewrite.php 
    ┃┣ robot.php 
    ┃┣ settings.php 
    ┃┣ share.php 
    ┃┣ show.php 
    ┃┣ sina.php 
    ┃┣ slide_index.php 
    ┃┣ sms.php 
    ┃┣ smtp.php 
    ┃┣ tag.php 
    ┃┣ tag_num.php 
    ┃┣ task.php 
    ┃┣ topicface.php 
    ┃┣ tusiji_face.php 
    ┃┣ ucenter.php 
    ┃┣ user.php 
    ┃┣ web_info.php 
    ┃┣ xss.php 
    ┣ templates 目录
    ┃┣ default 
    ┃┃┣ admin 后台模板目录
    ┃┃┣ images 模板图片目录
    ┃┃┣ js javascript目录
    ┃┃┣ styles 样式目录
    ┃┃┣ ajax_reminded.html
    ┃┃┣ blacklist.html 
    ┃┃┣ follow_right.inc.html 
    ┃┃┣ forward_list_ajax.html
    ┃┃┣ get_password_main.html
    ┃┃┣ global_login.html
    ┃┃┣ global_login_common.html
    ┃┃┣ group.html
    ┃┃┣ iframe_recommend.html
    ┃┃┣ iframe_share.html
    ┃┃┣ iframe_show.html
    ┃┃┣ index.htm
    ┃┃┣ index_recommend.html
    ┃┃┣ media.html
    ┃┃┣ media_more.html
    ┃┃┣ member_register.html
    ┃┃┣ member_step1.html
    ┃┃┣ member_step2.html
    ┃┃┣ messager.html
    ┃┃┣ modify_group_ajax.html
    ┃┃┣ modify_topic_ajax.html
    ┃┃┣ pm_left_menu.html
    ┃┃┣ pm_list.html
    ┃┃┣ pm_send_ajax.html
    ┃┃┣ pm_view.html
    ┃┃┣ pm_view_comment_ajax.html
    ┃┃┣ pm_write.html
    ┃┃┣ profile_main.html
    ┃┃┣ qqwb_bind_info.html
    ┃┃┣ report.inc.html
    ┃┃┣ search_list.html
    ┃┃┣ setting_main.html
    ┃┃┣ share.html
    ┃┃┣ share_publish.html
    ┃┃┣ showface.html
    ┃┃┣ tag_index.html
    ┃┃┣ tag_list_topic_box.html
    ┃┃┣ tag_menu.html
    ┃┃┣ topic_about.html
    ┃┃┣ topic_black_ajax.html
    ┃┃┣ topic_fans.html
    ┃┃┣ topic_follow.html
    ┃┃┣ topic_footer.html
    ┃┃┣ topic_forward_menu.html
    ┃┃┣ topic_group.html
    ┃┃┣ topic_group_ajax.html
    ┃┃┣ topic_group_menu.html
    ┃┃┣ topic_header.html
    ┃┃┣ topic_index.html
    ┃┃┣ topic_index_guest.html
    ┃┃┣ topic_list_ajax.html
    ┃┃┣ topic_list_manage.html
    ┃┃┣ topic_medal.html
    ┃┃┣ topic_new.html
    ┃┃┣ topic_publish.html
    ┃┃┣ topic_redirect.html
    ┃┃┣ topic_remark_ajax.html
    ┃┃┣ topic_reply_list_ajax.html
    ┃┃┣ topic_right.inc.html
    ┃┃┣ topic_share.html
    ┃┃┣ topic_share_1.html
    ┃┃┣ topic_share_2.html
    ┃┃┣ topic_show.html
    ┃┃┣ topic_simple_publish.html
    ┃┃┣ topic_theme.html
    ┃┃┣ topic_top.html
    ┃┃┣ topic_user_menu.html
    ┃┃┣ topic_user_tag.html
    ┃┃┣ topic_view.html
    ┃┃┣ topic_view_comment_ajax.html
    ┃┃┣ topic_vip.html
    ┃┃┣ topic_wap.html
    ┃┃┣ tplinfo.php
    ┃┃┣ user_face_menu.html
    ┃┃┣ user_follower_menu.html
    ┃┃┣ user_tag_ajax.html
    ┃┃┣ view_media.html
    ┃┃┣ view_notice.html
    ┃┃┣ vote_ajax_joined.html
    ┃┃┣ vote_create.html
    ┃┃┣ vote_daren_list_ajax.html
    ┃┃┣ vote_index.html
    ┃┃┣ vote_list.html
    ┃┃┣ vote_list_my_ajax.html
    ┃┃┣ vote_manage.html
    ┃┃┣ vote_me.html
    ┃┃┣ vote_publish.html
    ┃┃┣ vote_right.html
    ┃┃┣ vote_view.html
    ┃┃┣ weather.inc.1.html
    ┃┃┣ weather.inc.2.html
    ┃┃┣ weather_main.html
    ┣ uc_client uc客户端目录
    ┃┣  .......
    ┣ uc_server uc服务器端目录
    ┃┣  .......
    ┣ wap 目录
    ┃┣ cache 缓存目录
    ┃┣ include 引用包含目录
    ┃┣ modules 模块目录
    ┃┣ templates 模板目录
    ┃┣ index.php 首页

「倘若有所帮助,不妨酌情赞赏!」

Holmesian

感谢您的支持!

使用微信扫描二维码完成支付


相关文章

发表新评论
已有 2 条评论
  1. 木哈哈

    越来越不懂了,悲催啊

    木哈哈 回复
  2. 宁波麻将机

    我来逛逛,顺便帮博主顶一下,嘿嘿。

    宁波麻将机 回复