Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
lisisi
V2EX  ›  Linux

修改权限后 chmod -R 644 /var/app/files 动态创建的子文件夹,权限可以继承吗?

  •  
  •   lisisi · Oct 28, 2024 · 1855 views
    This topic created in 583 days ago, the information mentioned may be changed or developed.

    在应用程序中,为了让用户对于 app/files 都有访问下载文件的权限,修改权限后:

    chmod -R 644 /var/app/files

    再在 files 路径下,应用程序动态创建的 files/user_1, files/user_2, files/user_3... 这些子文件夹,还能继承 644 权限吗?

    7 replies    2024-10-29 09:34:37 +08:00
    xuyan1994
        1
    xuyan1994  
       Oct 28, 2024
    chown 下,然后用应用程序相关的用户执行就可以
    adoal
        2
    adoal  
       Oct 28, 2024
    在启动程序的脚本或者 systemd unit 里设置 umask
    dinghmcn
        3
    dinghmcn  
       Oct 28, 2024
    不能,文件默认权限由楼上说的 umask 决定,可以直接使用 umask 命令查看
    AlohaV2
        4
    AlohaV2  
       Oct 28, 2024
    chmod g+s?
    yulgang
        5
    yulgang  
       Oct 28, 2024
    在 /var/app/files 创建随机文件的命令前设置 umask 022 ,或者在执行二进制程序前先指定 umask 022
    guo4224
        6
    guo4224  
       Oct 29, 2024 via iPhone
    umask
    swLoXtOtd89pGg8t
        7
    swLoXtOtd89pGg8t  
       Oct 29, 2024
    sudo setfacl -Rdm u:username:rwx /path
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5652 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
    ♥ Do have faith in what you're doing.