mac brew 安裝php擴充報錯:parent directory is world writable but not sticky

來源:互聯網
上載者:User

標籤:https   ls -l   dir   git   mcrypt   homebrew   new   粘著位   檔案   

$ brew install php70-mcrypt

報錯:

Error: parent directory is world writable but not sticky

搜尋到github的答案

https://github.com/Homebrew/legacy-homebrew/issues/40345

 

原因:
/tmp目錄許可權不對

$ ls -ld /private/tmp

列印出來 /private/tmp 被標黃了

解決辦法:

$ sudo chmod +t /tmp

$ ls -ld /private/tmp

列印出來 /private/tmp 被標綠了,應該表示是正常的意思了

再次執行

$ brew install php70-mcrypt

安裝成功

 

知識點:

chmod +t

+t 表示設定粘著位(sticky bit),防止檔案或目錄被非屬主刪除

 

Set uid, gid,sticky bit的三個許可權的詳細說明:

一個檔案都有一個所有者, 表示該檔案是誰建立的. 同時, 該檔案還有一個組編號, 表示該檔案所屬的組, 一般為檔案所有者所屬的組.

如果是一個可執行檔, 那麼在執行時, 一般該檔案只擁有調用該檔案的使用者具有的許可權. 而setuid, setgid 可以來改變這種設定.

setuid: 設定使檔案在執行階段具有檔案所有者的許可權. 典型的檔案是 /usr/bin/passwd. 如果一般使用者執行該檔案, 則在執行過程中, 該檔案可以獲得root許可權, 從而可以更改使用者的密碼.

setgid: 該許可權只對目錄有效. 目錄被設定該位後, 任何使用者在此目錄下建立的檔案都具有和該目錄所屬的組相同的組.

sticky bit: 該位可以理解為防刪除位元. 一個檔案是否可以被某使用者刪除, 主要取決於該檔案所屬的組是否對該使用者具有寫入權限. 如果沒有寫入權限, 則這個目錄下的所有檔案都不能被刪除, 同時也不能添加新的檔案. 如果希望使用者能夠添加檔案,但同時不能刪除檔案, 則可以對檔案使用sticky bit位. 設定該位後, 就算使用者對目錄具有寫入權限, 也不能刪除該檔案.

 

mac brew 安裝php擴充報錯:parent directory is world writable but not sticky

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.