Stax
Tools

Chmod Calculator

Calculate Unix/Linux file permissions and get chmod command.

EntityRead (r)Write (w)Execute (x)OctalSymbolic
Owner (u)6rw-
Group (g)4r--
Others (o)4r--
Permission string
rw-r--r--
644
chmod 644 filename
Common permissions

Unixのファイル権限を理解する

シンボル表記の読み方

よくある権限の設定例

UnixまたはLinuxシステムのすべてのファイルとディレクトリには、所有者・グループ・その他のユーザーという3つの権限セットがあります。各セットには読み取り・書き込み・実行の3つのビットがあります。chmodコマンドはこれらの権限を変更します。権限を正しく設定することは、セキュリティと機能の両方にとって非常に重要です。

ls -lを実行すると、最初の列に-rwxr-xr-xのような権限が表示されます。最初の文字はファイルタイプ(-はファイル、dはディレクトリ)を示します。次の9文字は所有者・グループ・その他のユーザーそれぞれのrwxの3セットです。ダッシュ(-)はその権限が付与されていないことを意味します。

ウェブ開発者は共有ホスティングサーバーでSSH経由でchmodコマンドを実行する前に、Webサーバーファイルに適切なoctal値(PHPおよびHTMLファイルは644、ディレクトリは755)を調べるためにこの計算機を使います。SSHキーペアを生成するシステム管理者は、ツールが出力するそのまま使えるコマンドを使って秘密鍵を600に設定します。デプロイスクリプトを設定するDevOpsエンジニアは、octal表記を暗記せずにシェルスクリプトの正しい権限(755で実行可能にする)を確認します。Linuxの初心者はビジュアルなチェックボックスインターフェースでコマンドラインへ移行する前に権限システムをインタラクティブに理解するために使います。

  • 644: 標準ファイル — 所有者は編集可能で、全員が読み取り可能。
  • 755: 標準ディレクトリまたは実行ファイル — 所有者はフルアクセス、その他は読み取りとトラバースが可能。
  • 600: SSHキーなどのプライベートファイル — 所有者のみ読み書き可能。
  • 400: 読み取り専用プライベートファイル — 所有者のみ読み取り可能で、他は何もできない。
  • 777: 全員にフルアクセス — 絶対に必要な場合のみ使用し、本番環境では決して使わない。

よくある質問

What do Unix file permissions mean?
Unix file permissions control who can read (r=4), write (w=2), and execute (x=1) a file or directory. Permissions are set for three entities: the file owner (u), the group (g), and everyone else (o). The combined octal value is expressed as three digits, e.g., 755.
How does octal permission notation work?
Each digit in the octal notation represents permissions for one entity (owner, group, others) as a sum: read=4, write=2, execute=1. So rwx=7, rw-=6, r-x=5, r--=4, -wx=3, -w-=2, --x=1, ---=0. The permission 755 means owner has rwx (7), group has r-x (5), others have r-x (5).
What is the correct permission for a web server file?
Typically 644 (rw-r--r--) for files and 755 (rwxr-xr-x) for directories. This gives the owner read/write access, and read-only access to the web server process (which usually runs as a different user). Avoid 777 on web-accessible files — it is a security risk.
What is 777 permission and is it safe?
Permission 777 (rwxrwxrwx) gives everyone full read, write, and execute access. It is almost never appropriate for production files. It is a security vulnerability — any user or process on the system can modify or execute the file. Use only in controlled development environments.
How do I apply chmod recursively?
Use the -R flag: chmod -R 755 /path/to/directory. This applies the permission to the directory and all files and subdirectories inside it. Be careful — applying execute permission recursively to files that are not scripts can cause issues. Use find to apply different permissions to files vs. directories: find /path -type f -exec chmod 644 {} \; && find /path -type d -exec chmod 755 {} \;

関連ツール