The umask command umask sets the default blocking value for user files and directories. if you place this command into the profile file, you can control the access permission for subsequent files created by the user. The umask command is the opposite of the chmod command, which tells the system not to grant certain access permissions when creating files. Cp, mv, and cpio command cp command Copy text
Umask command
Umask sets the default blocking value for user files and directories. if you place this command into the profile file, you can control the access permission for subsequent files created by the user. The umask command is the opposite of the chmod command, which tells the system not to grant certain access permissions when creating files.
Cp, mv, and cpio commands
When the cp command is used to copy a file, if the target file does not exist, the access permission of the source file will be copied simultaneously, including the SUID and SGID licenses. The newly copied file is owned by the copied user. therefore, be careful when copying other users' files. do not be damaged by the SUID permission of other users.
When the mv command moves files, the new file access permission is the same as the original file, and the mv only changes the file name. As long as you have a directory write and search permission, you can move a file from the directory without changing its access permission. If the directory permission settings are incorrect, the user's files can be moved to a directory that cannot be modified or deleted by the user. a security vulnerability may occur.
The cpio command is used to copy the directory structure to a file, and then you can use the cpio command to convert the file to a directory structure.
Archive files store the information of each file, including the file owner, group users, last modification time, last access time, and file access permission method. Cpio security conventions are as follows:
Keep the access permission for the files created by the files stored in the files.
The owner and group users of each file extracted from the file are set to the user who runs the "cpio-I" command, rather than the owner and group users pointed out in the file.
When the user running the "cpio-I" command is root, the owner and group user of the created file are indicated by the archive file.
When the SUID/SGID file in the file is rebuilt, the SUID and SGID permissions are maintained. if the user of the file is not root, the SUID/SGID permission is the permission of the user/group indicated in the file.
File Encryption
The crypt command can be provided to users to encrypt files. The Command uses a keyword to encode the standard input information into unreadable and messy strings and sends them to the standard output device. Use this command again to apply the same keyword to the encrypted file to restore the file content. In general, after the file is encrypted, the original file should be deleted, leaving only the encrypted version, and the encryption keyword should be kept in mind.
Crypt programs may be used as Troy Trojans, so passwords cannot be used as keywords. It is best to compress the file with the pack or compress command before encryption, and then encrypt the file.