zoukankan      html  css  js  c++  java
  • Linux网络安全篇,进入SELinux的世界(二)

    一、简单的网页制作

    1.启动httpd服务

    /etc/init.d/httpd start

    2.编写首页网页文件

    echo "hello,this is my first webPage" > /var/www/html/index.html

    3.查看这个文件的权限与SELinux的安全上下文数据

    ll -Z /var/www/html/index.html

    -Z参数查看文件、文件夹上下文

    4.常见错误

    (1)

    echo ""......> /data/index.html

    cp /data/index.html  /var/www/html/index.html

    (2)

    这样的话,访问127.0.0.1是无法完成对网页的访问的。因为

    ls  -Z  /var./www/html/index.html

    我们会发现这个文件并没有httpd_t执行的权限。

    5.修改权限

    (1)方法一:

    chcon [-R] [-t type] [-u user] [-r role] 文件
    chcon [-r] --reference=范例文件 文件

    -R ===> 递归修改

    -t ===> 接上下文类型字段

    -u ===> 后面接身份标识

    -r ===> 后面接角色

    (2)方法二:

    restorecon -[Rv] 文件或目录

    根据SELinux自定义的规则还原该目录下的文件上下文属性

    -R ===> 连同子目录一起修改

    -v ===> 将过程显示到屏幕上

  • 相关阅读:
    openpyxl处理excel
    python播放声音
    python利用wave对声音数据进行处理
    线性代数相关知识
    《深度学习》笔记-卷积神经网络
    Django--知识补充
    Django--2、form表单
    Django--4、认证系统
    Django--1、MTV及基本应用
    前端--3、jQuery
  • 原文地址:https://www.cnblogs.com/viplanyue/p/12700493.html
Copyright © 2011-2022 走看看