我在Ubuntu 10_04 LTS上以用户www-data身份运行apache。 我已经用'umask 002'设置了/ etc / apache2 / envvar,这样守护进程创build的任何新文件/目录都会启用组写入权限。 有时,我需要从命令行创build文件/目录,所以我做了“sudo -u www-data”命令,但是我不知道如何让这些文件在创build时启用组写入权限。
在/ etc / passwd中,Ubuntu的主目录被列为'/ var / www'。 所以,根据Ubuntu的文档( https://help.ubuntu.com/community/EnvironmentVariables ),我已经尝试添加“umask 002”到以下位置:
/var/www/.profile
/var/www/.bashrc
- Apache每个站点禁用deflate模块
- Varnish,Nginx,Apache,APC,Meteor,Cpanel&WordPress单服务器上,有什么好处?
- 每分钟测量一次“加载时间(毫秒)”
- 负载平衡器w /基于名称的虚拟主机
- VirtualHost指向相同的DocumentRoot?
/var/www/.bash_profile
在/ var / WWW / bash_login
而全球环境文件:
在/ etc /环境
/etc/bash.bashrc
即使在所有这些文件中添加“umask 002”并重新启动,运行“sudo -u www-data touch testfile”结果为“-rw -r -r–”权限。 (我试图将www-data shell设置为/ bin / sh和/ bin / bash。)
有没有什么方法可以设置,以便“sudo -u www-data”命令将创build启用组写入权限的项目?
你有尝试通过/etc/sudoers本身设置吗? 按照sudoers(5) :
umask_override If set, sudo will set the umask as specified by sudoers without modification. This makes it possible to specify a more permissive umask in sudoers than the user's own umask and matches historical behavior. If umask_override is not set, sudo will set the umask to be the union of the user's umask and what is specified in sudoers. This flag is off by default.