Linux命令第二篇

作业二:

1)   在用户的主目录下创建目录test,进入test创建空文件file1

# ls /home/test

file

2)   以长格式形式显示文件信息,注意文件的权限和所属用户和组

# ls -l

总用量 0

-r--r-xr-x. 1 root root 0 3月  15 15:06 file

3)   为文件file1设置权限,使其他用户可以对此文件进行写操作

# chmod o=w file

4)   查看设置结果,

# ll

总用量 0

-r--r-x-w-. 1 root root 0 3月  15 15:06 file

5)   取消同组用户对文件file1的读取权限,并查看设置结果。

chmod g-r file

# ll

总用量 0

-r----x-w-. 1 root root 0 3月  15 15:06 file

6)   用数字表示法为文件file设置权限,所有者可读、可写、可执行,所属组用户和其他用户只具有读和执行的权限。设置完成后查看设置结果。

# chmod 755 file

[root@localhost test]# ll

总用量 0

-rwxr-xr-x. 1 root root 0 3月  15 15:06 file

7)   用数字形式更改文件file1的权限,使所有者只能读取此文件。其他任何用户都没有权限。查看设置结果。

# chmod 400 file

[root@localhost test]# ll

总用量 0

-r--------. 1 root root 0 3月  15 15:06 file

8)   回到上层目录,查看test的权限

# ll

drwxr-xrwx.  2 root   root       17 3月  15 15:06 test

9)  为其他用户添加对此目录的写权限

]# chmod o=w test

[root@localhost home]# ll

drwxr-x-w-.  2 root   root       17 3月  15 15:06 test

原文地址:https://www.cnblogs.com/asaka/p/6557707.html