chmod と chown によるファイル権限と所有権
Linux の権限の仕組みと chmod、chown による設定方法を学び、ユーザー管理とセキュリティへの理解を深めます。
「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/passwdThe Three Permission Bits
r(read) = 4w(write) = 2x(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.shchmod 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.shMaking 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.shChanging 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.txtChanging Only the Group
You can change just the group with chgrp or with the :group form of chown.
sudo chown :developers project.txtRecursive Changes
The -R flag applies changes to a directory and everything inside it. Use carefully.
sudo chown -R alice:developers /srv/appDefault 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.
umaskA 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/appQuick 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)
chmodsets modes via octal or symbolschown/chgrpreassign ownership-Rapplies recursively;umasksets 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フィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ユーザーとグループの管理:`useradd`、`usermod`、`groupadd`
- ネットワークコマンド入門:`ping`、`ip`、`netstat`
- 安全なリモートアクセス:`ssh`と`scp`
- chmod と chown によるファイル権限と所有権