
https://geek-university.com/linux/set-the-default-permissions-for-newly-created-files/
所以我想要我的umask
(命令),在這種情況下是從文件和資料夾的預設基本權限0002
中減去(按位) 。例如,此處文件的結果為 664。666
777
這樣我就可以更改chmod
使用該新遮罩建立的檔案的權限,這當然是您建立檔案時的預設遮罩touch
。
我怎樣才能做到這一點?
答案1
$ echo 'ibase=8; obase=8; (( 0666 - 0002 ))' | bc
644
$ echo 'ibase=8; obase=8; (( 0777 - 0002 ))' | bc
775