zoukankan      html  css  js  c++  java
  • find命令下排除部分目录修改权限

    #!/bin/bash
    # 项目文件夹、文件权限修改
    # 批量修改文件夹或者文件的权限时,需要先忽略掉可写文件夹('./bootstrap/cache''./public/attachments''./public/images''./storage')
    
    # 忽略 './bootstrap/cache' './public/attachments' './public/images' './storage' 文件夹及子文件
    ignore_path="-not -path './bootstrap/cache' -and -not -path './bootstrap/cache/*' -and -not -path './public/attachments' -and -not -path './public/attachments/*' -and -not -path './public/images' -and -not -path './public/images/*' -and -not -path './storage' -and -not -path './storage/*'"
    find_dirs="find . -type d $ignore_path"
    find_files="find . -type f $ignore_path"
    # 修改文件夹权限为 555
    chmod_dirs="sudo $find_dirs -exec chmod 555 {} ;"
    # 修改文件权限为 444
    chmod_files="sudo $find_files -exec chmod 444 {} ;"
    
    
    #echo $chmod_dirs
    #echo $chmod_files
    eval $chmod_dirs; eval $chmod_files
  • 相关阅读:
    6种基本排序(C++实现)
    关于 ^ 异或 及 无中间变量进行交换
    清理C盘旧驱动
    sqlmap基本使用
    http头部注入
    waf绕过注入
    mysql报错注入
    Burp Suite工具使用
    mysql注入
    Linux网络配置
  • 原文地址:https://www.cnblogs.com/mikeluwen/p/8706893.html
Copyright © 2011-2022 走看看