the linux command line學習筆記之四

來源:互聯網
上載者:User

標籤:linux command

linux許可權相關命令:

● id             顯示使用者ID
● chmod     修改檔案許可權
● umask     設定預設的檔案許可權

● su            以另一個使用者的身份運行shell
● sudo        以另一個使用者的身份執行命令

● chown     修改檔案的owner

● chgrp       修改檔案的group owner
● passwd    修改使用者的密碼


許可權與二進位八進位的對應

八    二      許可權

0     000     ---
1     001     --x
2     010     -w-
3     011     -wx
4     100     r--
5     101     r-x
6     110     rw-
7     111     rwx


在命令列中可以使用如下的簡寫:

u    user的簡寫,但指的是owner;

g    group的簡寫,指的是group owner;

o    other的簡寫;

a    all的簡寫;

u+x    owner許可權加執行許可權

u-x    owner許可權移除執行許可權

+x      即all+x

o-rw    即other-rw

go=rw    即group,other=rw

u+x,go=rx    即user+x, group&other=rx


umask的意義:

umask=0000,0666-0000=0666,即--- rw- rw- rw-

umask=0002,0666-0002=0664,即--- rw- rw- r--

umask=0022,0666-0022=0644,即--- rw- r-- r--


chmod參數解釋:

bob          Changes the ownership of the file from its current owner to user
                bob.
bob:users     Changes the ownership of the file from its current owner to user
                     bob and changes the file group owner to group users.

:admins        Changes the group owner to the group admins. The file owner is
                     unchanged.
bob:              Change the file owner from the current owner to user bob and
                     changes the group owner to the login group of user bob.








the linux command line學習筆記之四

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.