Linux Study notes second week fourth class (February 1)

Source: Internet
Author: User
Tags parent directory file permissions

2.18 Special Permissions Set_uid


Permission S,set_uid, in addition to the owner of the user, the execution of an instantaneous temporary owner rights;

The file to be satisfied is a binary executable file;

User password file/etc/shadow

File plus Set_uid permissions #chmod u+s/usr/bin/ls

Ls-l View permissions can be seen, RWS permission; red Display file

File minus Set_uid permissions #chmod u-s/usr/bin/ls

file plus set_uid permissions, Another method #chmod U=rws /usr/bin/ls

Ls-l View permissions can be seen, RWS permissions;

If other users have execute permission, they already have set_uid permission;

If there is no execute permission, plus x permission #chmod u+x /usr/bin/ls

Ls-l View permissions can be seen, RWS permissions, s to S;

The directory does not need to set SET_UID permissions, because the directory is only a path, the executable itself;


2.19 Special Permissions Set_gid


S,set_gid, add the owning group permission, other users under the owning group have this permission

the file belongs to the group Plus s permission, #chmod G+s /usr/bin/ls file becomes yellow mark

Directory belongs to the group plus s permissions,#chmod g+s 234, and then this directory to create a file or directory, the owning group and set_ The GID directory remains consistent, and if the directory is not set Set_gid, it will be consistent with the current user;


2.20 Special Permissions Stick_bit


Stick_bit, anti-delete bit, the purpose is to prevent being deleted by other users, the/tmp directory has this permission by default;

/tmp directory, the temporary file directory of the system, all users in the directory has all the permissions, that is, in this directory can be arbitrarily created, modify, delete files, if user A in this directory created a file, User B deleted the file, this situation we can not allow. To achieve this, the concept of stick bit (sticky bit) is present. It is for the directory, if the directory is set stick bit (sticky bit), then the files in this directory in addition to the file creator and root user can be deleted and modified. /tmp directory of files/directories, can not move others, this is the role of sticky bit.

/tmp, create file aming, #touch aming

User aming, set aming file permissions, #chmod 777 aming

Other users, delete the aming file, #rm-F aming do not allow deletion

Other directory 777 permissions, directories under Files and directories, other people can also be deleted, and the file is not related to subdirectory permissions, and the parent directory permissions;

Set directory stick_bit, command for #chmod o+s directory;


2.21 Soft Link Files


Soft links, equivalent to Windows shortcuts, a path, soft link file size and path length related;

set a soft link in the format #ln- s source file soft link file

For example, #ln-S/tmp/yum.log/root/111/yum.log

View Soft link file, display, soft link file, source file;

Soft Link Application:

View disk partitions, #df-H

/boot partition is almost full, write files and logs/boot/aming.log, full words will cause system crashes;

Copy files to other partitions, #cp/boot/aming.log/aming.log

Delete the original file, #rm/boot/aming.log

Create a soft link file, #ln-S/aming.log/boot/aming.log

Soft links supporting files, directories, cross-partition;


2.22 hard-Link files


Hard links, unsupported directories, inode numbers, only support hard links to files, hard links do not support cross-partition, each partition has inode number;

Set up a hard link, #ln 1.txt 1_heard.txt

Hard links, source files and hard-link files, file size is the same, using the same inode number, two files are hard-linked files to each other, do not occupy double space, equivalent to a skin, a total of two skins;

Hard links are not deleted, not affected, soft links, delete source files, soft link files will be wrong;


Linux Study notes second week fourth class (February 1)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.