Linux System Programming 22 File System-File Attributes and FAT File System

1 umask
umask: The
Insert picture description here
umask command to prevent files with too loose permissions is encapsulated with umask().
Umask can also be used in the code:

NAME
umask - set file mode creation mask

SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>

   mode_t umask(mode_t mask);

2 Change and management of file permissions

NAME
chmod, fchmod, fchmodat - change permissions of a file

SYNOPSIS
#include <sys/stat.h>

   int chmod(const char *pathname, mode_t mode);
   int fchmod(int fd, mode_t mode);

3 The sticking bit
t bit is now often used to set the t bit for a specific directory, such as the tmp directory
drwxrwxrwt in the root directory. The last bit is the t bit, so that each user's operations on the tmp directory and files in it will be more specialized Up.

mhr@ubuntu:~/work/linux/wenjianxitong/20$ 
mhr@ubuntu:~/work/linux/wenjianxitong/20$ ls / -l
total 100
drwxr-xr-x   2 root root  4096 Apr  8 22:58 bin
drwxr-xr-x   3 root root  4096 May  1 03:40 boot
drwxrwxr-x   2 root root  4096 Sep  2  2019 cdrom
drwxr-xr-x  18 root root  3980 May  3 08:50 dev
drwxr-xr-x 132 root root 12288 May  3 08:50 etc
drwxr-xr-x   3 root root  4096 Sep  2  2019 home
lrwxrwxrwx   1 root root    33 May  1 03:40 initrd.img -> boot/initrd.img-4.4.0-178-generic
lrwxrwxrwx   1 root root    33 May  1 03:40 initrd.img.old -> boot/initrd.img-4.4.0-177-generic
drwxr-xr-x  22 root root  4096 Sep  2  2019 lib
drwxr-xr-x   2 root root  4096 Apr  8 22:55 lib64
drwx------   2 root root 16384 Sep  3  2019 lost+found
drwxr-xr-x   4 root root  4096 Sep  2  2019 media
drwxr-xr-x   3 root root  4096 Sep  2  2019 mnt
drwxr-xr-x   2 root root  4096 Sep  2  2019 opt
dr-xr-xr-x 245 root root     0 May  3 08:49 proc
drwx------   3 root root  4096 Apr 23 05:34 root
drwxr-xr-x  26 root root   820 May  4 19:13 run
drwxr-xr-x   2 root root 12288 Apr  8 22:58 sbin
drwxr-xr-x   2 root root  4096 Apr  8 23:00 snap
drwxr-xr-x   2 root root  4096 Apr 20  2016 srv
dr-xr-xr-x  13 root root     0 May  3 08:49 sys
drwxrwxrwt  12 root root  4096 May  4 19:17 tmp
drwxr-xr-x  11 root root  4096 Apr 20  2016 usr
drwxr-xr-x  14 root root  4096 Apr 20  2016 var
lrwxrwxrwx   1 root root    30 May  1 03:40 vmlinuz -> boot/vmlinuz-4.4.0-178-generic
lrwxrwxrwx   1 root root    30 May  1 03:40 vmlinuz.old -> boot/vmlinuz-4.4.0-177-generic
mhr@ubuntu:~/work/linux/wenjianxitong/20$ 

4 File system: FAT UFS
file system: storage and management of files or data
To be added...

Guess you like

Origin blog.csdn.net/LinuxArmbiggod/article/details/105928993