LoginSignup
1
0

More than 5 years have passed since last update.

linux パーミッション chmod

Last updated at Posted at 2019-03-25

概要

chmodはファイル or ディレクトリに対する権限を設定するコマンド。
ユーザー区分ごとに権限を設定できる。

数字

読み込み権限 書き込み権限 実行/folder access
r w x
4 2 1

記号

記号 意味
u 所有者の権限
g グループの権限
o その他のユーザーの権限
a すべての権限
+ 権限を付加する
- 権限を削除する
= 権限にセットする
r 読み込み権限
w 書き込み権限
x 実行権限
s セットID
t スティッキ・ビット

setuid

passwd コマンドの setuid アクセス権によってユーザーはroot権限として実行できる

ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 59640 Jan 26  2018 /usr/bin/passwd

setgid

実行ファイルの所有グループの権限で実行することができる

sticky

ディレクトリ内のファイルを保護するアクセス権ビットです

設定したら、そのファイルを削除できるのはその所有者、ディレクトリの所有者、または特権を持つユーザーだけ

sample

# 実行権限を追加
chmod +x test

# 書き込み権限を削除
chmod u-w test

# dirフォルダ全部766にする
chmod -R 766 dir
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0