권한 및 소유권: `chmod`, `chown`
데이터에 대한 접근을 안전하게 제어할 수 있도록 파일 권한과 소유권을 이해하고 관리합니다.
권한 및 소유권: `chmod`, `chown`은(는) CoddyKit의 무료 Linux Command Line Mastery 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Linux Command Line Mastery 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Linux Command Line Mastery 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Permissions: Who Can Do What?
In Linux, file permissions and ownership are vital for security and managing access to your data. They determine who can read, write, or execute files and directories.
Think of it like a set of rules for your digital property. Without proper permissions, anyone could access or modify your important files!
The Three Pillars: UGO
Linux permissions are categorized into three main types of users, often referred to as UGO:
- User (Owner): The person who created the file or directory.
- Group: A collection of users who share specific access rights to the file.
- Others: Everyone else on the system who is not the owner and not part of the file's group.
Action Types: Read, Write, Execute
For each of the UGO categories, there are three basic types of actions they can perform:
- Read (r): Allows viewing the file's content or listing a directory's contents.
- Write (w): Allows modifying or deleting the file, or creating/deleting files within a directory.
- Execute (x): Allows running a file (if it's a program or script) or entering a directory.
Viewing Permissions with `ls -l`
You can see a file's permissions and ownership using the ls -l command. This command provides a detailed, 'long' listing of files.
The first column shows the file type and permissions in a symbolic format, like -rwxr-xr--.
touch example.txt
ls -l example.txt`chmod`: Symbolic Mode Basics
The chmod (change mode) command is used to change file permissions. In symbolic mode, you specify who (u, g, o, a) gets what permission (r, w, x) using operators (+, -, =).
u: user (owner)g: groupo: othersa: all (u, g, o)+: add permission-: remove permission=: set permission exactly
`chmod` Symbolic Mode in Action
Let's make our example.txt file executable for the owner, readable for the group, and remove all permissions for others.
Notice how the permissions string changes after each command.
touch example.txt
chmod u+x example.txt
chmod g=r example.txt
chmod o-rwx example.txt
ls -l example.txt`chmod`: Octal Mode Explained
Octal mode is a numerical way to set permissions. Each permission (r, w, x) is assigned a numerical value:
r(read) = 4w(write) = 2x(execute) = 1
You sum these values for each UGO category. For instance, rwx (4+2+1) is 7, and r-x (4+0+1) is 5.
`chmod` Octal Mode Example
Common octal permissions include:
755: Owner (rwx), Group (rx), Others (rx)644: Owner (rw), Group (r), Others (r)600: Owner (rw), Group (-), Others (-)
Let's set example.txt to rw-r--r-- (644).
touch another_file.txt
chmod 644 another_file.txt
ls -l another_file.txtChanging Ownership with `chown`
The chown (change owner) command is used to change the user and/or group ownership of a file or directory.
Its basic syntax is chown [USER]:[GROUP] [FILE]. You can change just the user, just the group, or both. This command usually requires sudo privileges.
`chown` in Practice
Let's create a file and then change its owner. For this example, we'll assume a user named 'coddy' exists. If not, replace 'coddy' with an existing user on your system.
Note: You'll likely need sudo to execute chown.
touch owned_file.txt
ls -l owned_file.txt
# Assuming 'coddy' is a valid user
sudo chown coddy owned_file.txt
ls -l owned_file.txtPermissions Check
You have a file named report.txt. You want the owner to have full read, write, and execute permissions. The group should only have read and execute permissions. Others should have no permissions at all.
Which chmod command (octal mode) achieves this?
Recap: Master Your Files!
Great job! You've learned how to manage file permissions and ownership in Linux.
ls -lshows permissions in symbolic format.chmodchanges permissions using symbolic (u+r) or octal (755) modes.chownchanges the owner and/or group of a file, often requiringsudo.
Understanding these commands is crucial for securing your system and collaborating effectively!
자주 묻는 질문
“권한 및 소유권: `chmod`, `chown`” 강의는 무료인가요?
네 — “권한 및 소유권: `chmod`, `chown`” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Linux Command Line Mastery 강의 전체를 잠금 해제할 수 있습니다. Linux Command Line Mastery 강의에는 총 4개의 강의가 포함되어 있습니다.
“권한 및 소유권: `chmod`, `chown`”에서 뭘 배우나요?
데이터에 대한 접근을 안전하게 제어할 수 있도록 파일 권한과 소유권을 이해하고 관리합니다. 브라우저에서 직접 실행하는 실습 코드로 Linux Command Line Mastery을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Linux Command Line Mastery을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Linux Command Line Mastery은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“권한 및 소유권: `chmod`, `chown`” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Linux Command Line Mastery 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Linux Command Line Mastery 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 파일 내용 보기: `cat`, `less`, `more`
- 파일 검색: `find`와 `locate`
- 권한 및 소유권: `chmod`, `chown`
- 기호 링크 만들고 따라가기