The default user and user group of 4.6 new files

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
(Disclaimer: This article is my self "programming" Unix environment W.Richard Stenvens second version of the study notes, the title of the article in front of the number and the corresponding book chapters, examples are self-made, have been tested under Linux. I read the legal profession, political teachers, file opinions are not correct, but do not represent the authority, to learn to write, just borrow this place notes, so please readers must identify absorption!)

The open and creat functions are used to create new files, the link function is used to create a hard link, symlink is used to create a symbolic link, MKDIR is used to create a new directory. These functions can be viewed as a function to create a new file. The functions of the prototype are summarized as follows:

int open (const char *pathname, int oflag, ...);
int creat (const char *pathname, mode_t mode);
int link(const char *existingpath, const char *newpath);
int symlink(const char *actualpath, const char *sympath);
int mkdir(const char *pathname, mode_t mode);

Obviously, the parameters of these functions are not user owner ID and all group ID. At the same time, any file generation must have owner and permissions, or the system is not safe. No user parameters, and user information, it must be to take some default mechanisms to set user information.
1, The new file (including the new directory) user ID:
All UNIX system will build a valid user ID files ID set to process.
2, The new file (including the new directory) of group ID:
Different UNIX system or file system to the new file set group ID scheme is different.
FreedBSG5.2.1 and Mac OS X 10.3 system:
Always use the directory group ID as the new ID file group.
The POSIX.1 standardAllowed to choose:
(1)The new file group ID can be effective group ID process,
(2)The new file group ID is the directory ID.
Linux ext2 and the ext3 file system:
(1)A new S_ISGID file directory is 1, then the new file group ID is set to the directory group ID,
(2)A new S_ISGID file directory is 0, then the new file group ID is set to a valid set of ID process.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Carl at December 07, 2013 - 9:15 PM