Linuxのファイル権限について

Linuxのファイル権限について

ファイルへの読み取り/書き込み権限を知りたかったので、これをしました。

ls -l Denem.sh

このコマンドは以下を表示します。

-rwxr-xr-x  1 pavan employee 672 DEC 20  2000 pavan.sh

誰か-rwxr-xr-xが何を意味するのか教えてもらえますか?
Wikipedia.comで-rwxr-xr-xが意味するものを見つけました。

-rwxr-xr-xは、
ユーザークラスに完全な権限を持ち、グループや他のクラスには読み取りおよび実行権限のみを持つ一般的なファイルを意味します。

今私の質問は途中で何かを取るべきですか?(-xr-)考慮する? ?

ベストアンサー1

この文字列は:

-rwxr-xr-x

4つの部分に分かれています:

-    indicates what kind of file it is
rwx  (first 3) owner permissions
r-x  (second 3) group permissions
r-x  (last 3) other permissions

全体的に、この文字列はファイルの最も重要な側面を(一目で)提供する必要があります。言い換えれば、それが何であり、誰がそれで何をすることができますか。


セクション1

文字列の最初の文字はファイルタイプ用に予約されています。一般的な古いファイルはすべて-この場所にあります。その他は以下の通りです。

d directory
p pipe/fifo
l link
c character device file
b block device file
s local domain socket

したがって、パイプラインは次のようになります。

prwx------ root root filename

2-3-4四半期

次の9ビットは、各人がファイルに対して持つ権限を説明します。権限には3種類あります。

r read (opening the file for reading, can't save changes)
w write (change the contents of file)
x execute (run the file, like a script or binary)

これらの権限は3つのグループに適用できます。

owner whoever owns the file (as seen by the output of ls -l)
group whoever is part of the group owner of this file
others anyone who doesn't fall in either of the two above categories

たとえば、

-rwxr-xr-x  1 pavan employee 672 DEC 20  2000 pavan.sh
pavan is the owner
employee is the group owner name
anyone else falls into "others"

pavan上記の例を参照して、ファイルに対するすべての権限が必要な場合は、employeeグループ内のすべての人がファイルを読み取りまたは実行できるようにし、すべての権限をブロックしますothers

-rwxr-x---

数字

権限が時々数字で表示されるのは、9桁の8進表現を使用する方が簡単なためです(私はまだ直接表現を好むrwx)。

この数値が何を意味するのかを理解するには、テーブルを作成する必要があります(バイナリを試したことがある場合は役に立ちます)。

#  r  w  x
0  0  0  0
1  0  0  1
2  0  1  0
3  0  1  1
4  1  0  0
5  1  0  1
6  1  1  0
7  1  1  1

このチャートを参照して、3桁の数字の各グループを理解できます。たとえば、ファイル所有者にすべての権限(r、w、x)を付与することを決定した場合、そのグループと他のすべての人だけが読み取ることができます。

rwx owner corresponds to 7 in the table
r-- group corresponds to 4 in the table
r-- other corresponds to 4 in the table
Therefore my file has permissions 744

おすすめ記事