[Linux學習]檔案屬性及許可權

來源:互聯網
上載者:User

1. 核心命令

chgrp :改變檔案所屬群組
chown :改變檔案擁有者
chmod :改變檔案的許可權, SUID, SGID, SBIT 等等的特悵

 

2. 範例一(chgrp)

 [root@www ~]# chgrp users install.log
 [root@www ~]# ls -l
 -rw-r--r-- 1 root users 68495 Jun 25 08:53 install.log
 [root@www ~]# chgrp testing install.log
 chgrp: invalid group name `testing' <== 發生錯諢訊息囉~找丌到這個群組名~

3. 範例二(chown)

範例:將 install.log 的擁有者改為 bin 這個帳號:
[root@www ~]# chown bin install.log
[root@www ~]# ls -l
-rw-r--r-- 1 bin users 68495 Jun 25 08:53 install.log

範例:將 install.log 的擁有者不群組改回為 root:
[root@www ~]# chown root:root install.log
[root@www ~]# ls -l
-rw-r--r-- 1 root root 68495 Jun 25 08:53 install.log

 

4. 範例三(chmod)

    ○數字方式更改許可權

[root@www ~]# chmod 777 .bashrc
[root@www ~]# ls -al .bashrc
-rwxrwxrwx 1 root root 395 Jul 4 11:45 .bashrc

    ○符號方式更改許可權

               u

               g          +(加入)                    r

chmod                  -(出去)                    w             檔案或目錄

               o          =(設定)                    x

               a

相關文章

聯繫我們

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