Linux组
- Linux中的每个用户必须属于一个组,不能独立于组外。在Linux中每个文件有所属用户、所在组的概念;
- 所属者:这个文件是哪个用户的;一般为文件的创建者,
- 所在组:这个文件所在的组;
查看路径下文件信息
- 查看文件的所属者:ls -ahl
- 示例:创建一个police组的用户tom,用tom创建一个文件 tom.txt
[root@ming ~]# groudadd police
bash: groudadd: 未找到命令...
[root@ming ~]# groupadd police
[root@ming ~]# usradd -g police tom
bash: usradd: 未找到命令...
[root@ming ~]# useradd -g police tom
[root@ming ~]# su tom
[tom@ming ~]$ cd //这里切换到tom的home目录,不然创建tom.txt权限不够
[tom@ming ~]$ touch tom.txt
[tom@ming ~]$ ls -ahl
总用量 16K
drwx------. 5 tom police 143 3月 4 15:37 .
drwxr-xr-x. 7 root root 77 3月 4 15:32 ..
-rw-------. 1 tom police 27 3月 4 15:33 .bash_history
-rw-r--r--. 1 tom police 18 8月 8 2019 .bash_logout
-rw-r--r--. 1 tom police 193 8月 8 2019 .bash_profile
-rw-r--r--. 1 tom polic