Linux Study Notes (permission issues)

Source: Internet
Author: User
Linux Study Notes (permission issues)-Linux general technology-Linux technology and application information, the following is a detailed description. [Root @ linux ~] # Cd/tmp
[Root @ linux tmp] # mkdir testing
[Root @ linux tmp] # chmod 744 testing
[Root @ linux tmp] # touch testing/testing
[Root @ linux tmp] # chmod 600 testing/testing
# The mkdir command is used to create a directory! Is the abbreviation of make directory.
# Use the root identity to create a directory named testing under/tmp,
# Change the permission of this directory to 744. The owner of this directory is root!
# In addition, touch can be used to create a file with no content. Therefore, touch testing/testing
# Create an empty/tmp/testing file!
[Root @ linux tmp] # ls-al
Drwxr -- r -- 2 root 4096 Jul 14 0:05 testing
# Let's take a closer look. The permission for the directory is 744, And the permissions for the group and user are root!
# Next, we will switch the root identity to a common identity user.
# Laruence's system has a general dmtsai user account, so it switches to dmtsai.
[Root @ linux tmp] # su dmtsai
# The su command is used to change the identity. We will introduce it in detail in the future.
# Note: In the bottom line, the user is found to have changed to dmtsai, and the prompt character is changed to $!
# That is to say, the operating system is now changed to dmtsai! So dmtsai
#/Tmp/testing is the permission of others. What can he do with/tmp/testing?
[Dmtsai @ linux tmp] $ ls-l testing <= the identity is dmtsai
Total 0
? ---------? ? ? ? ? Testing
# Check the information! Because dmtsai has the r permission, after all, the permissions are insufficient,
# Many materials are actually question marks (?) Come ~ Strange and tight ~
[Dmtsai @ linux tmp] $ cd testing <= at this time, the identity is dmtsai
Bash: cd: testing/: Permission denied
# Found? Even if we have the r permission, but do not have x, so
# Dmtsai cannot access/tmp/testing!
[Dmtsai @ linux tmp] $ exit
[Root @ linux tmp] # chown dmtsai testing
# Use exit to exit the su function. We set the owner of this testing directory
# Dmtsai: At this time, dmtsai becomes the owner, so what can this user do?
[Root @ linux tmp] # su dmtsai
[Dmtsai @ linux tmp] $ cd testing <= at this time, the identity is dmtsai
[Dmtsai @ linux testing] $ ls-l <= at this time, the identity is dmtsai
-Rw ------- 1 root 0 Jul 14 0:13 testing
# Switch your identity to dmtsai, and then you will be able to access testing! Check the content.
# Found the file testing! Only the root user can access the database ~
# Can I delete it?
[Dmtsai @ linux testing] $ rm testing <= at this time, the identity is dmtsai
Rm: remove write-protected regular empty file 'testing '? Y
# It can be deleted! Do you understand this?

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.