Linux下Apache设置上传文件时候的默认权限(umask)

本文介绍了两种更改Apache服务器中umask设置的方法,一种是通过编辑 /usr/local/apache/bin/envvars 文件,另一种是在 CentOS 和其他 Red Hat 发行版中修改 /etc/sysconfig/httpd 文件。这些方法可以帮助用户自定义文件权限,满足特定的需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

方法一:

Apache/Php umask determines the permissions for the newly created files. On a VPS / Dedicated server you can change the umask to suit your specific needs by editing:
/usr/local/apache/bin/envvars
There you should add:
umask 022
Right after that restart Apache and Apache/Php's default umask will become 22.

 

方法二:

For CentOS and other Red Hat distros, add the umask setting to /etc/sysconfig/httpd and restart apache.

[root ~]$ echo "umask 002" >> /etc/sysconfig/httpd

[root ~]$ service httpd restart


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值