Linux Command Line Mastery · レッスン

chmod と chown によるファイル権限と所有権

Linux の権限の仕組みと chmod、chown による設定方法を学び、ユーザー管理とセキュリティへの理解を深めます。

レッスン 4/413 ステップ

「chmod と chown によるファイル権限と所有権」はCoddyKit上の無料Linux Command Line Masteryレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはLinux Command Line Mastery学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Linux Command Line Masteryコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Permissions Connect Users and Files

Now that you can create users and groups, the next step is controlling what each user can do with files. Linux enforces this through file permissions and ownership.

Reading ls -l Output

ls -l shows a permission string like -rwxr-xr--. The first char is the file type; the next three triples are permissions for owner, group, and others.

ls -l /etc/passwd

The Three Permission Bits

  • r (read) = 4
  • w (write) = 2
  • x (execute) = 1

Add them per triple to get an octal digit. rwx = 7, r-x = 5, r-- = 4.

chmod with Octal

chmod 754 file sets owner rwx, group r-x, others r--.

chmod 754 script.sh
ls -l script.sh

chmod with Symbols

You can also add or remove specific bits: u=user, g=group, o=others, a=all.

chmod u+x script.sh
chmod go-w script.sh

Making a Script Executable

A very common task: give a newly written script execute permission so you can run it directly.

chmod +x deploy.sh
./deploy.sh

Changing Ownership with chown

chown user:group file reassigns who owns a file. This ties directly into the user/group management you already learned.

sudo chown alice:developers project.txt

Changing Only the Group

You can change just the group with chgrp or with the :group form of chown.

sudo chown :developers project.txt

Recursive Changes

The -R flag applies changes to a directory and everything inside it. Use carefully.

sudo chown -R alice:developers /srv/app

Default Permissions and umask

New files get default permissions masked by umask. A umask of 022 removes write for group and others, producing 644 files and 755 directories.

umask

A Safe Workflow

When sharing a project directory with a team: set the group, grant group read/write, and keep others restricted.

sudo chown -R :developers /srv/app
sudo chmod -R 770 /srv/app

Quick Check

What octal value represents rwxr-xr--?

Recap

You now control access to files:

  • Permissions split into owner/group/others with r(4)/w(2)/x(1)
  • chmod sets modes via octal or symbols
  • chown/chgrp reassign ownership
  • -R applies recursively; umask sets defaults
無料で開始

AI チューターと学ぶ Linux Command Line Mastery — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
12
レッスン
48

よくある質問

「chmod と chown によるファイル権限と所有権」レッスンは無料ですか?

はい。「chmod と chown によるファイル権限と所有権」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Linux Command Line Masteryコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Linux Command Line Masteryコースには全4レッスンが含まれています。

「chmod と chown によるファイル権限と所有権」で何を学びますか?

Linux の権限の仕組みと chmod、chown による設定方法を学び、ユーザー管理とセキュリティへの理解を深めます。 ブラウザで直接実行するハンズオンコードでLinux Command Line Masteryを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Linux Command Line Masteryを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのLinux Command Line Masteryは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「chmod と chown によるファイル権限と所有権」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このLinux Command Line Masteryレッスンでコードを書いて実行できますか?

はい。すべてのLinux Command Line Masteryレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. ユーザーとグループの管理:`useradd`、`usermod`、`groupadd`
  2. ネットワークコマンド入門:`ping`、`ip`、`netstat`
  3. 安全なリモートアクセス:`ssh`と`scp`
  4. chmod と chown によるファイル権限と所有権
← Linux Command Line Masteryに戻る