~/UnixCourse
You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. No one else should be able to do any of these things.
(This is a good setting for directories where you will keep assignments for various courses. After this assignment, your ~/UnixCourse directory should always be set this way.)
~/UnixCourse/fileAsst
You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. People in your group should be able to do ls and to access files, but not add/remove files from the directory. People outside your group should be able to do none of these things.
(Actually, no one but you will really have access to this directory because it’s inside ~/UnixCourse and, if you’ve done the prior step correctly, they can’t get inside there to get to fileAsst. But, for the sake of this exercise, we’ll ignore that fact.)
~/UnixCourse/fileAsst/Empire
You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to use ls but have no other privileges.
~/UnixCourse/fileAsst/Alliance
You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to access files in the directory for which they already know the names, but have no other privileges.
~/UnixCourse/fileAsst/Empire/darth.txt
Everyone should be able to read and write to this file.
~/UnixCourse/fileAsst/Alliance/r2d2.txt
We will pretend, for the sake of this assignment, that this file contains an executable program. You should be able to read and write to this file. You and members of your group should be able to execute it. People other than you have no other privileges.
这是我对这个问题的解决方案:
chmod 700 UnixCourse
chmod 740 fileAsst
chmod 744 ~/UnixCourse/fileAsst/Empire
chmod 666~/UnixCourse/fileAsst/Alliance
chmod 670~/UnixCourse/fileAsst/Empire/darth.txt
chmod 660~/UnixCourse/fileAsst/Alliance/r2d2.txt
我不断收到一条错误消息,说对 unixcourse 的保护是正确的,但是对 fileAsst 的保护不允许我的组成员访问它们,但它应该。我将通过 u(用户)、g(组)、o(其他)、a(全部)+ 添加权限并 - 删除权限。 4 为读取,2 为写入,1 为执行。
我缺少什么?
先谢谢啦~!
答案1
fileAsst
是一个权限为 740 的目录。这意味着该组的成员(除了所有者之外)可以读取 的内容fileAsst
,但不能创建fileAsst
其当前目录。这会产生奇怪的结果,他们可以列出 中的文件fileAsst
,但看不到这些文件的详细信息。
我fileAsst
在家里创建,将passwd
文件复制到其中并授予它这些权限。因此:
$ ls -l fileAsst/
ls: cannot access 'fileAsst/passwd': Permission denied
total 0
-????????? ? ? ? ? ? passwd
您需要fileAsst
至少授予执行权限,即 750 或 770。