Error: A case analysis of/usr/include/stdio.h:permission denied

Source: Internet
Author: User

Error: A case analysis of/usr/include/stdio.h:permission denied
Code:
    1. #include <stdio. h>
    2. int main(){
    3. printf ("Hello long size%d\n", sizeof(long));
    4. }
It is easy to test whether it can be compiled by
Contrast
    • Under root user compile normal pass
    • In other user tests do not pass

      Click ( here) to collapse or open

      1. ~> GCC test.c
      2. Test.c:1:19:error:/usr/include/stdio.h:permission denied
      3. test.c:in function ' main ':
      4. Test.c:5: warning:incompatible Implicit declaration of built-in function ' printf '

Try to solve the problem

under root user, look at the properties of stdio.h

Click ( here ") collapse or open

  1. ll/usr/include/stdio.h
  2. -rw-r--r--1 root root 31144 2010-05-06 10:33/us R/include/stdio.h
has a readable property, but with Vim open, the display is a [new file], why? The
has the readable permission just can't see the file!

Add executable permissions to the document, chmod +x/usr/include/stdio.h
Problem

Add executable permissions to link, # find/usr/include/-type l-exec ls -l {} \;
Problem

Remove the executable permission of link, # find/usr/include/-type l-exec chmod-x  {} \;

Add executable permissions to the folder, # find/usr/include/-type d-exec chmod +x  {} \;
Problem Resolution

Analysis
I don't understand what it is related to open/usr/include/stdio.h and other folder executable permissions, because/usr/include and/usr/include/stdio.h are both feasible and users should be able to read stdio.h files.

This situation occurs during the migration process, in order to prevent unnecessary trouble, add the following command, Chmod-r 755/usr/include/

Error: A case analysis of/usr/include/stdio.h:permission denied

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.