Linux之檔案許可權

2021-09-27 08:20:31 字數 2403 閱讀 6550

檔案許可權設定:可以賦予某個使用者或組 能夠以何種方式  訪問某個檔案

檔案許可權管理之:ugo設定基本許可權(r、w、x)

許可權物件:

屬主: u

屬組:   g

其他人: o

許可權型別:

讀:r      4

寫:w     2

執行:x  1

例子:

rw-         r--          r-- alice hr install.log

屬主       屬組      其他

對於上面的檔案:

alice有什麼許可權???

alice是所有者,所以擁有rw許可權

jack屬於hr組,它擁有什麼許可權???

jack擁有r許可權

tom有什麼許可權???

tom是其他使用者,用於r許可權。

命令:chown

修改用於屬主、屬組

修改屬主:

-rw-r--r--. 1 root root      14 2月  17 17:52 test

[root@localhost ~]# chown xiaoming test

-rw-r--r--. 1 xiaoming root      14 2月  17 17:52 test

修改屬主和屬組

[root@localhost ~]# chown xiaoming.xiaoming test 

[root@localhost ~]# ll test 

-rw-r--r--. 1 xiaoming xiaoming 14 2月  17 17:52 test

修改屬組:

[root@localhost ~]# ll test1 

-rw-r--r--. 1 root root 16 2月  17 17:58 test1

[root@localhost ~]# chown .xiaoming test1

[root@localhost ~]# ll test1

-rw-r--r--. 1 root xiaoming 16 2月  17 17:58 test1

命令:chgrp:

[root@localhost ~]# ll test3

-rw-r--r--. 1 root root 16 2月  17 18:01 test3

[root@localhost ~]# chgrp xiaoming test3 

[root@localhost ~]# ll test3 

-rw-r--r--. 1 root xiaoming 16 2月  17 18:01 test3

[root@localhost ~]# 

更改許可權:chmod:

修改屬主許可權,新增可執行許可權:

[root@localhost ~]# ll test1

-rw-r--r--. 1 root xiaoming 16 2月  17 17:58 test1

[root@localhost ~]# chmod u+x test1

[root@localhost ~]# ll test1

-rwxr--r--. 1 root xiaoming 16 2月  17 17:58 test1

修改屬組許可權,新增可執行許可權:

[root@localhost ~]# ll test1

-rwxr--r--. 1 root xiaoming 16 2月  17 17:58 test1

[root@localhost ~]# chmod g+x test1

[root@localhost ~]# ll test1

-rwxr-xr--. 1 root xiaoming 16 2月  17 17:58 test1

給所有人新增讀寫執行許可權

[root@localhost ~]# ll test1

-rwxr-xr--. 1 root xiaoming 16 2月  17 17:58 test1

[root@localhost ~]# chmod a=rwx test1

[root@localhost ~]# ll test1

-rwxrwxrwx. 1 root xiaoming 16 2月  17 17:58 test1

Linux之檔案許可權

先簡單地說一下使用者與使用者組,這兩個概念很好理解。linux是乙個多人多任務的系統,因此,乙個系統中可能有多個使用者同時在使用。但是每個人都會有自己的私密檔案,不想讓別人知道,這個時候,你就可以把自己的私密檔案設定成 只有檔案擁有者,就是我,才能看和修改這份檔案 是不是會很安全。但是假如是另一種情...

linux之檔案許可權

linux多人多任務,多人共用一台主機,所以對許可權管理較為嚴格,需要劃分以增強安全性。linux每個檔案都擁有user,group,others三種身份的許可權。檔案擁有者 將自己的內容存放在自己的目錄中。群組 按組劃分,乙個賬號可以擁有多個群組 其他 群組之外的人 系統上的賬號與一般身份使用者 ...

Linux基礎之檔案許可權

基礎概念 你要明白的第一件事是檔案許可權可以用來幹什麼。當你設定乙個分組的許可權時發生了什麼?讓我們將其展開來說,這個概念就真的簡單多了。那到底什麼是許可權?什麼是分組呢?你可以設定的3種許可權 讀 允許該分組讀檔案 用r表示 寫 允許該分組寫檔案 用w表示 執行 允許該分組執行 執行 檔案 用x表...