Write custom directory title here
A command to modify the user group
1 Add user group
groupadd hadoop
2 Delete user group
groupdel Hadoop
3 Rename user group
groupmod -n hadoop1 hadoop
4 Check which groups have been created
[root@localhost ~]# cat /etc/group
root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:
cdrom:x:11:
mail:x:12:postfix
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
nobody:x:99:
users:x:100:
utmp:x:22:
utempter:x:35:
input:x:999:
systemd-journal:x:190:
systemd-network:x:192:
dbus:x:81:
polkitd:x:998:
ssh_keys:x:997:
sshd:x:74:
postdrop:x:90:
postfix:x:89:
apache:x:48:
mysql:x:27:
xieyitang:x:1000:
lisi:x:1001:
hadoop1:x:1002:
5 Modify the user's group
Move a user to another user group
Two commands to modify file permissions
1 file permissions
File permissions are mainly composed of three three-digit binary numbers
000 -777
用户本身 用户所在的组其他成员 其他组成员
000 000 000
111 111 111
二进制的数据
读 写 执行
1 1 1
具体操作
具体修改文件权限的操作 777
[root@localhost ~]# touch /usr/tmp/1.txt
[root@localhost ~]# chmod 777 1.txt
chmod: 无法访问"1.txt": 没有那个文件或目录
[root@localhost ~]# cd /usr/tmp
[root@localhost tmp]# chmod 777 1.txt
2 Change file owner
修改了文件的所有者
[root@localhost tmp]# ls -al
总用量 4
drwxrwxrwt. 3 root root 96 5月 14 09:16 .
drwxr-xr-x. 21 root root 4096 4月 24 20:59 ..
-rwxrwxrwx. 1 root root 0 5月 14 09:16 1.txt
drwx------. 3 root root 17 4月 20 03:42 systemd-private-ff18a778f7354bc5b537d63e95d0dd26-httpd.service-nFL43a
[root@localhost tmp]# chown test1 1.txt
[root@localhost tmp]# ls -al
总用量 4
drwxrwxrwt. 3 root root 96 5月 14 09:16 .
drwxr-xr-x. 21 root root 4096 4月 24 20:59 ..
-rwxrwxrwx. 1 test1 root 0 5月 14 09:16 1.txt
drwx------. 3 root root 17 4月 20 03:42 systemd-private-ff18a778f7354bc5b537d63e95d0dd26-httpd.service-nFL43a
3 Change the group to which the file belongs
Chgrp 改变用户所属的组
chgrp 最终用户组 (功能描述:改变文件或者目录的所属组)
[root@localhost tmp]# chgrp root 1.txt
[root@localhost tmp]# ls -al
总用量 4
drwxrwxrwt. 3 root root 96 5月 14 09:16 .
drwxr-xr-x. 21 root root 4096 4月 24 20:59 ..
-rwxrwxrwx. 1 test1 root 0 5月 14 09:16 1.txt
drwx------. 3 root root 17 4月 20 03:42 systemd-private-ff18a778f7354bc5b537d63e95d0dd26-httpd.service-nFL43a
[root@localhost tmp]# chown root 1.txt