Skip to content

File permissions

Linux & the command line Lesson 11 2:20 English narration · English + 中文 subtitles burned in

space play · ←/→ 5s · j/l 10s · f fullscreen · ,/. speed

Chapters

Transcript
Run l s dash l and every line starts with ten characters that look like line noise. 跑一下 ls -l,每一行开头都有十个看起来像乱码的字符。
They are not. 它们不是乱码。
They are four fields: one, then three threes. 它们是四个字段:一个,然后是三组三个。
The first character is the type. 第一个字符是类型。
Then three for the owner, three for the group, three for everyone else. 然后三个给属主,三个给用户组,三个给其他所有人。
Cut it up like that and it stops being line noise. 这样切开之后,它就不再是乱码了。
Each group of three answers the same three questions in the same order. 每一组三个字符,按同样的顺序回答同样的三个问题。
R means may read its contents. r 表示可以读它的内容。
W means may change or delete it. w 表示可以修改或删除它。
X means may run it as a program. x 表示可以把它当程序运行。
And a dash in that slot means that one is not allowed. 而那个位置上的短横表示这一项不被允许。
So r w x r dash x r dash x says: the owner can do everything, and everyone else can read and run it but not change it. 所以 rwx r-x r-x 的意思是: 属主什么都能做,其他所有人可以读、可以运行,但不能修改。
There is a shorter way to write a group, and it is not a code to memorise — it is arithmetic. 写一组权限还有一种更短的写法,而它不是要背的代号——它是算术。
R is worth four, w is worth two, x is worth one. r 值 4,w 值 2,x 值 1。
Add up the ones you want. 把你想要的那几项加起来。
All three is four plus two plus one, which is seven. 三项全要就是 4+2+1,等于 7。
Read and run is four plus one, which is five. 可读可执行是 4+1,等于 5。
Read only is four. 只读就是 4。
C h m o d — change mode — takes one digit per group, in the same order as the letters. chmod——change mode——每一组一个数字,顺序和字母的顺序一样。
Seven five five: seven for the owner, so all three; five for the group and five for others, so read and run but not write. 755:属主是 7,三项全有; 组和其他人都是 5,可读、可执行,但不能写。
That combination is so common it has a name — it is the classic runnable program. 这个组合太常见了,以至于它有个名字—— 它就是那个经典的"可执行程序"权限。
Four things to take with you. 带走四点。
One: the ten characters are type, owner, group, others. 第一:那十个字符是类型、属主、用户组、其他人。
Two: r read, w write, x execute, and a dash means no. 第二:r 读、w 写、x 执行,短横表示不允许。
Three: r is four, w is two, x is one, and you add them up. 第三:r 是 4,w 是 2,x 是 1,把它们加起来。
Four: c h m o d seven five five gives the owner everything and the rest r and x. 第四:chmod 755 给属主全部权限,其余人可读可执行。
Now type the tasks into the terminal below. 现在把下面那些题目敲进终端里。

Log in or create account

IGCSE, A-Level & AP