php创建文件夹模式0700-0777,cd后的umask设置更改

简短的回答是:umask有四位数字并且不会任意改变,但/ etc / profile和恶魔默认会将其设置为022;

更新 b>的结果,

我有点厌倦了,忘了正确回答你的问题:

检查安装在您更改的文件夹上的分区(如果有),没有设置umask。 (只需键入mount)

答案很长的答案是:

男人chmod

§6:

数字模式是从一​​到四个八进制数字(0-7),通过加总得出

值为4,2和1的位。假定省略的数字为前导

零。第一个数字选择设置的用户ID(4)并设置组ID(2)和

限制删除或粘性(1)属性。第二个数字选择

拥有该文件的用户的权限:read(4),write(2)和execute

(1);第三个选择文件组中其他用户的权限

相同的价值观;和第四个不在文件组中的其他用户

相同的价值观。

GNU coreutils 8.14 2011年10月

我记得几年前曾几次读过这个手册页,从来没有

在设置表格之前,要完全理解所有这些意味着什么。自从我

丢失了我的参考表,我将在这里重新创建它。因为我不喜欢象征性的

因为打字比较麻烦(例如chmod u + x),我会遗漏

任何提及它。

解释chmod和umask h1>

可能的设定:

4:阅读

2:写

1:执行

每个数字的可能值,带有示例 h2>

domain setuid user group world

digit 1 2 3 4

values 0-7 0-7 0-7 0-7`possible setting' values in the curly braces {} may be

summed together to produce a valid permission bit (number).

Common examples

0755: The user may enter a folder and write (remove) files in that folder

If this mask is set on a file, the the user may execute the file (i.e.

./filenme.bin). The last two digits mean that the group to which the

file belongs and the world (anyone else on the system), may execute

the file as well. Applied to direcotories it means that the group and

world may enter that directory.

0644: User may read and write a file, but not execute it. Group and world

may only read the file. Applied to a folder, this mask wil prevent

anyone from entering that directory.

0600: Only the owner may read and write a file with this mask

0700: Only the owner of a folder may enter, read and write the contents of a

folder with this mask.

0000: Useful for "hiding" files or for signaling (to yourself) that a file

or a folder is not supposed to be used.

Meaningless masks

0200: If a user can write a file, then they may also alter the umask of a file.

Dangerous masks

0666: Everyone can read, write to and delete a file with this mask

0777: Same thing for a folder. If a binary file is set 777, then anyone can put

anything they want into that file and run it, even if it is in the system-

wide binaries directory such as /usr/bin.

4755: Binary files owned by the superuser (root) will run with superuser

permissions. The implications of this should be clear. Perhaps, counder-

intuitively setting an interpreted-script with 4755 will have no effect

becasue a script (such as a bash script) is still run by /bin/bash. The

text file where the script is stored is not really an executable.

In all of the above examples, the leading zero may be omitted for convenience.

Converting umask to chmod

To set a proper umask, all that needs to be done is subtracting the unwanted

permissions from the `最大掩码'对于文件夹为0777,对于文件夹为666

文件。

要强制shell创建具有644设置umask的默认权限的文件

0022.对于文件夹,典型的(期望的)umask可能是755并且是通过

将umask设置为0022。

0666 0777

-0022 -0022

____ ____

0644 0755

相关链接:

https://unix.stackexchange.com/questions/364/allow-setuid-on-shell-scripts

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值